Anyone succeeded to send SMTP-mail using CDO.Message and CDO.Configuration?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Henrik Bergman

    Anyone succeeded to send SMTP-mail using CDO.Message and CDO.Configuration?

    Hi all

    As I subscribe MSDN I got an USB-memory with Microsoft eLearing library.

    I found an exampell how to send SMTP e-mail using CDO.Message object and
    CDO.Configurati on.

    MSDN has also got a simular example, but it didn't work for me.

    But when I try to send it, it answers, "The transport failed to connect
    to server". I suppose that means the SMTP-server. Since I used that
    SMTP-server several times when I send e-mail, I can't figure out why I
    doesn't work. Has anyone succeeded to run the mail-example?

    MSDN has also got a simular example, but it didn't work for me.

    Note: I don't use user/password, so I changed Authenticate to cdoAnonymous.

    Regards

    Henrik Bergman

    Dim MyMessage As New CDO.Message()
    Dim Config As New CDO.Configurati on()

    ' Specify the configuration.
    Config.Fields(c doSendUsingMeth od) = cdoSendUsingPor t
    Config.Fields(c doSMTPServer) = "test.mailserve r.com"
    Config.Fields(c doSMTPServerPor t) = 25
    Config.Fields(c doSMTPAuthentic ate) = cdoBasic
    Config.Fields(c doSendUserName) = "username"
    Config.Fields(c doSendPassword) = "password"

    ' Update the configuration.
    Config.Fields.U pdate()
    MyMessage.Confi guration = Config

    ' Create the message.
    MyMessage.To = "someone@somewh ere.com"
    MyMessage.From = "me@somewhere.c om"
    MyMessage.Subje ct = "Hello"
    MyMessage.TextB ody = "This is the message!"

    ' Send the CDOSYS Message
    MyMessage.Send( )

Working...