pls help!sending a simple txt email using cdo

hi...
im using the following code...

Private Sub Form_Load()
Set objMessage = CreateObject("CDO.Message")
objMessage.Subject = "Simple plain text CDO example"
objMessage.From = "cimmaron_odd@hotmail.com"
objMessage.To = "stoned_afrit@yahoo.com"
objMessage.TextBody = "This is a test."
objMessage.Send
End Sub


when i do this i get n error stating 'the "sendusing" configuration value is invalid' and the last line of the code is high lighted..

what m i doing wrong? pls help..

tc

Comments

  • : hi...
    : im using the following code...
    :
    : Private Sub Form_Load()
    : Set objMessage = CreateObject("CDO.Message")
    : objMessage.Subject = "Simple plain text CDO example"
    : objMessage.From = "cimmaron_odd@hotmail.com"
    : objMessage.To = "stoned_afrit@yahoo.com"
    : objMessage.TextBody = "This is a test."
    : objMessage.Send
    : End Sub
    :
    :
    : when i do this i get n error stating 'the "sendusing" configuration
    : value is invalid' and the last line of the code is high lighted..
    :
    : what m i doing wrong? pls help..
    :
    : tc


    well...i figured it out myself...

    heres how it wud work..




    'sends email
    Set objMessage = CreateObject("CDO.Message")
    objMessage.Subject = "example subject"
    objMessage.From = "cimaron_odd@hotmail.com.com"
    objMessage.To = "cimmaron.odd@gmail.com"
    objMessage.TextBody = "this is a test mail"
    'adds attachment
    objMessage.AddAttachment "path of the file to be attached"

    ' Configure the send to use another server
    objMessage.Configuration.Fields.Item _
    ("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2

    ' Now we provide the configuration information for the remote SMTP server
    ' (normally you will only change the server name or IP)
    ' Name or IP of Remote SMTP Server
    objMessage.Configuration.Fields.Item _
    ("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "ur smtp server"

    ' Server port (usually 25)
    objMessage.Configuration.Fields.Item _
    ("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25

    ' Save the new configuration settings
    objMessage.Configuration.Fields.Update

    objMessage.Send

    End Sub
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

In this Discussion