![]() |
![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
| Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks. |
| |||||||
![]() |
| |
| | #1 (permalink) |
| | How to do SMTP-AUTH-Login with CDO.Message? Hello, I'd like to send an e-mail with a vbs script. To keep things short, I'll go straight to the code and the error message: THE CODE: schema = "http://schemas.microsoft.com/cdo/configuration/" Set objEmail = CreateObject("CDO.Message") With objEmail .From = "address@xxxxxx" .To = "address@xxxxxx" .Subject = "Testmail" .Textbody = Now & " --> TESTMAIL " With .Configuration.Fields .Item (schema & "sendusing") = 2 .Item (schema & "smtpserver") = "mail.gmx.net" .Item (schema & "smtpserverport") = 25 .Item (schema & "smtpauthenticate") = cdoBasic .Item (schema & "sendusername") = "address@xxxxxx" .Item (schema & "sendpassword") = "cleartextpassword" .Item (schema & "smtpconnectiontimeout") = 30 End With .Configuration.Fields.Update .Send End With THE EXECUTION (and ERROR): D:\>cscript //nologo mailing.vbs D:\mailing.vbs(22, 3) (null): Der Server hat die Absenderadresse zurückgewiesen. Die Serverantwort lautet: 550 5.7.0 Need to authenticate via SMTP-AUTH-Login {mp006} Part of this is in german since I'm running it on a german version of windows xp pro. The 2 german sentences mean the following: "Der Server hat die Absenderadresse zurückgewiesen." = "The server has rejected the senders address." "Die Serverantwort lautet" = "The server response is" I've searched quite some time now on how to solve this issue, but couldn't really find any resources on how to do an SMTP-AUTH-Login with the CDO stuff?! Anyone has a hint for me? Kind regards, Chris |
My System Specs![]() |
| | #2 (permalink) |
| | Re: How to do SMTP-AUTH-Login with CDO.Message? Hi Christian, Quote: > > THE CODE: > schema = "http://schemas.microsoft.com/cdo/configuration/" > Set objEmail = CreateObject("CDO.Message") > > With objEmail > .From = "address@xxxxxx" > .To = "address@xxxxxx" > .Subject = "Testmail" > .Textbody = Now & " --> TESTMAIL " > With .Configuration.Fields > .Item (schema & "sendusing") = 2 > .Item (schema & "smtpserver") = "mail.gmx.net" > .Item (schema & "smtpserverport") = 25 > .Item (schema & "smtpauthenticate") = cdoBasic > .Item (schema & "sendusername") = "address@xxxxxx" > .Item (schema & "sendpassword") = "cleartextpassword" > .Item (schema & "smtpconnectiontimeout") = 30 > End With > .Configuration.Fields.Update > .Send > End With > > > THE EXECUTION (and ERROR): > D:\>cscript //nologo mailing.vbs > D:\mailing.vbs(22, 3) (null): Der Server hat die Absenderadresse > zurückgewiesen. Die Serverantwort lautet: 550 5.7.0 Need to authenticate via > SMTP-AUTH-Login {mp006} > > > Part of this is in german since I'm running it on a german version of > windows xp pro. The 2 german sentences mean the following: > "Der Server hat die Absenderadresse zurückgewiesen." = "The server has > rejected the senders address." > "Die Serverantwort lautet" = "The server response is" > > I've searched quite some time now on how to solve this issue, but couldn't > really find any resources on how to do an SMTP-AUTH-Login with the CDO > stuff?! Anyone has a hint for me? > -- Code -- ..Item (schema & "smtpusessl") = vbTrue ----- Greetings from Germany Dirk |
My System Specs![]() |
| | #3 (permalink) |
| | Re: How to do SMTP-AUTH-Login with CDO.Message? Hi Dirk, Actually I already tried the mailing script with and without the smtpusessl setting, but just to ensure that it really doesn't make a difference I tried it once again: The result is the same error message, also if I change the port number to 465 (which is the setting for ssl in my mail client for example). As far as I know the smtp server requires first to authenticate with the pop3 server, is that possible? If so, do you have an idea on how to do that via a script, since CDO can only send mails (and not retrieve them), no? Kind regards, Chris "Dirk Stegemann" wrote: Quote: > > possibly only this little line of code is missing.. > > -- Code -- > ..Item (schema & "smtpusessl") = vbTrue > ----- |
My System Specs![]() |
| | #4 (permalink) |
| | Re: How to do SMTP-AUTH-Login with CDO.Message? Hi Chris, Quote: > Actually I already tried the mailing script with and without the smtpusessl > setting, but just to ensure that it really doesn't make a difference I tried > it once again: > The result is the same error message, also if I change the port number to > 465 (which is the setting for ssl in my mail client for example). > > As far as I know the smtp server requires first to authenticate with the > pop3 server, is that possible? If so, do you have an idea on how to do that > via a script, since CDO can only send mails (and not retrieve them), no? > I had to create an acount for gmx. While looking for a solution i found this very interesting page... http://www.paulsadowski.com/WSH/cdo.htm used a sample.. -- Const cdoSendUsingPickup = 1 'Send message using the local SMTP service pickup directory. Const cdoSendUsingPort = 2 'Send the message using the network (SMTP over the network). Const cdoAnonymous = 0 'Do not authenticate Const cdoBasic = 1 'basic (clear-text) authentication Const cdoNTLM = 2 'NTLM Set objMessage = CreateObject("CDO.Message") objMessage.Subject = "Example CDO Message" objMessage.From = """Me"" <me@xxxxxx>" objMessage.To = "test@xxxxxx" objMessage.TextBody = "This is some sample message text.." & vbCRLF & "It was sent using SMTP authentication." '==This section provides the configuration information for the remote SMTP server. objMessage.Configuration.Fields.Item _ ("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2 'Name or IP of Remote SMTP Server objMessage.Configuration.Fields.Item _ ("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "mail.your.com" 'Type of authentication, NONE, Basic (Base64 encoded), NTLM objMessage.Configuration.Fields.Item _ ("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = cdoBasic 'Your UserID on the SMTP server objMessage.Configuration.Fields.Item _ ("http://schemas.microsoft.com/cdo/configuration/sendusername") = "gmxcustno" 'Your password on the SMTP server objMessage.Configuration.Fields.Item _ ("http://schemas.microsoft.com/cdo/configuration/sendpassword") = "yourpassword" 'Server port (typically 25) objMessage.Configuration.Fields.Item _ ("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25 'Use SSL for the connection (False or True) objMessage.Configuration.Fields.Item _ ("http://schemas.microsoft.com/cdo/configuration/smtpusessl") = False 'Connection Timeout in seconds (the maximum time CDO will try to establish a connection to the SMTP server) objMessage.Configuration.Fields.Item _ ("http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout") = 60 objMessage.Configuration.Fields.Update '==End remote SMTP server configuration section== objMessage.Send -- and it worked You have to check if the setting under E-Mail-->Optionen-->Sicherheit is set to SMTP mit Login (maximale Sicherheit) Dirk |
My System Specs![]() |
| | #5 (permalink) |
| | Re: How to do SMTP-AUTH-Login with CDO.Message? Hi Dirk, Quote: > it took aliitle time... > > I had to create an acount for gmx. Quote: > While looking for a solution i found this very interesting page... > > http://www.paulsadowski.com/WSH/cdo.htm > > used a sample.. > the script I used. Quote: > and it worked THE SOLUTION: Since several online tutorials used the cdoBasic variable I thought this is a constant variable always available. But that's not the fact, one has to define it in a script to be able to use. Once I defined/declared the variable at the top of the script (or replaced it with a 1), the script just worked fine. Thank you very much! Kind regards, Chris |
My System Specs![]() |
| | #6 (permalink) |
| | Re: How to do SMTP-AUTH-Login with CDO.Message? "Christian Schratter" <ChristianSchratter@xxxxxx> wrote in message news:C40C973D-E496-4BD9-BA39-E8B33D48DCFA@xxxxxx Quote: > Since several online tutorials used the cdoBasic variable I thought this > is > a constant variable always available. But that's not the fact, one has to > define it in a script to be able to use. Once I defined/declared the > variable > at the top of the script (or replaced it with a 1), the script just worked > fine. Files (WSF) over regular VBScript Files. In a lot of objects you can add the reference flag and the constants are automatically defined for you. Save the below as 'example.wsf' for demonstrative purposes: <job> <object id="objEmail" progid="CDO.Message" reference="true"/> <script language="VBScript"> MsgBox cdoBasic </script> </job> |
My System Specs![]() |
| | #7 (permalink) |
| | Re: How to do SMTP-AUTH-Login with CDO.Message? "Christian Schratter" <ChristianSchratter@xxxxxx> wrote in message news:C40C973D-E496-4BD9-BA39-E8B33D48DCFA@xxxxxx Quote: > Hi Dirk, > > Quote: >> it took aliitle time... >> >> I had to create an acount for gmx. > At first I'd like to thank you for your dedication to this issue. > > Quote: >> While looking for a solution i found this very interesting page... >> >> http://www.paulsadowski.com/WSH/cdo.htm >> >> used a sample.. >> > I already found that page as well, but there seemed to be no difference to > the script I used. > > Quote: >> and it worked > > THE SOLUTION: > Since several online tutorials used the cdoBasic variable I thought this > is > a constant variable always available. But that's not the fact, one has to > define it in a script to be able to use. Once I defined/declared the > variable > at the top of the script (or replaced it with a 1), the script just worked > fine. VBScript can give you a list and/or execute 'CONST constant = whatever' statements for every constant known to the object's typelib. To find a short script that demonstrates this, type the following into groups.google.com's search box: "oConstant.name" group:*.scripting.vbscript Note that you may have to download and install a Microsoft DLL. -Paul Randall |
My System Specs![]() |
![]() |
| Thread Tools | |
| |
Similar Threads | ||||
| Thread | Forum | |||
| RE: Error sending SMTP MAil message in c# | .NET General | |||
| SMTP error message | Vista mail | |||
| OE - error ERR auth not enabled? | Vista mail | |||
| SMTP Auth and Windows Mail | Vista mail | |||
| VPN auth BEFORE login (domain users) | Vista networking & sharing | |||