Windows Vista Forums

CDO.Message authentication??
  1. #1


    PAkerly Guest

    CDO.Message authentication??

    I'm trying to send an email message to outside of my domain
    recipients. I get a relay not allowed message. I need to
    authenticate.

    Can this be done with this code? FYI, emails are sent fine if sent
    within mycompany.com domain



    Set objFSO = CreateObject("Scripting.FileSystemObject")
    Set objFolder = objFSO.GetFolder(strFolder)
    '
    Set objMessage = CreateObject("CDO.Message")
    objMessage.Subject = "Test email"
    objMessage.From = "me@newsgroup"
    objMessage.To = "me@newsgroup"
    objMessage.TextBody = "This is some sample message text"
    For Each objFile In objFolder.Files
    strFileExt = objFSO.GetExtensionName(objFile.Path)
    objMessage.AddAttachment objFile.Path
    Next
    'Configuration Info
    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") =
    "myserver.mycompany.com"
    'Server port (typically 25)
    objMessage.Configuration.Fields.Item _
    ("http://schemas.microsoft.com/cdo/configuration/smtpserverport") =
    25
    objMessage.Configuration.Fields.Update
    '==End remote SMTP server configuration section==
    objMessage.Send

      My System SpecsSystem Spec

  2. #2


    Pegasus [MVP] Guest

    Re: CDO.Message authentication??



    "PAkerly" <pakerly@newsgroup> said this in news item
    news:0bf01f85-a565-4680-87ef-a61b897fdb31@newsgroup

    > I'm trying to send an email message to outside of my domain
    > recipients. I get a relay not allowed message. I need to
    > authenticate.
    >
    > Can this be done with this code? FYI, emails are sent fine if sent
    > within mycompany.com domain
    >
    > Set objFSO = CreateObject("Scripting.FileSystemObject")
    > Set objFolder = objFSO.GetFolder(strFolder)
    > '
    > Set objMessage = CreateObject("CDO.Message")
    > objMessage.Subject = "Test email"
    > objMessage.From = "me@newsgroup"
    > objMessage.To = "me@newsgroup"
    > objMessage.TextBody = "This is some sample message text"
    > For Each objFile In objFolder.Files
    > strFileExt = objFSO.GetExtensionName(objFile.Path)
    > objMessage.AddAttachment objFile.Path
    > Next
    > 'Configuration Info
    > 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") =
    > "myserver.mycompany.com"
    > 'Server port (typically 25)
    > objMessage.Configuration.Fields.Item _
    > ("http://schemas.microsoft.com/cdo/configuration/smtpserverport") =
    > 25
    > objMessage.Configuration.Fields.Update
    > '==End remote SMTP server configuration section==
    > objMessage.Send
    Here is how you could authenticate yourself to an external SMTP server:

    const cdoBasic=1
    schema = "http://schemas.microsoft.com/cdo/configuration/"
    Set objEmail = CreateObject("CDO.Message")
    With objEmail
    .From = "James@newsgroup"
    .To = "Jim@newsgroup"
    .Subject = "Test Mail"
    .Textbody = "The quick brown fox " & Chr(10) & "jumps over the lazy dog"
    .AddAttachment "d:\Testfile.txt"
    With .Configuration.Fields
    .Item (schema & "sendusing") = 2
    .Item (schema & "smtpserver") = "mail.company.com"
    .Item (schema & "smtpserverport") = 25
    .Item (schema & "smtpauthenticate") = cdoBasic
    .Item (schema & "sendusername") = "James@newsgroup"
    .Item (schema & "smtpaccountname") = "James@newsgroup"
    .Item (schema & "sendpassword") = "SomePassword"
    End With
    .Configuration.Fields.Update
    .Send
    End With



      My System SpecsSystem Spec

CDO.Message authentication?? problems?

Similar Threads
Thread Thread Starter Forum Replies Last Post
General authentication problem windows authentication as SQLauthentication Dawid Kolodziejczyk Server General 0 01 Sep 2009
authentication Vale Vista mail 1 24 Apr 2008
Asking for authentication Chris Vista mail 0 16 Jan 2008
authentication conservativeadvisor Vista mail 2 06 Aug 2007
Authentication over VPN? Jim H Vista account administration 0 21 Dec 2006