CDO.Message

  • Thread starter Thread starter Eduard
  • Start date Start date
E

Eduard

When sending mail I get the classic 'Cannot access CDO.Message object'
exception. I remember I solved this problem once before, but cannot remember
how :-)

I'm sending mail using an existing from address, an existing to address, and
SmtpMail.SmtpServer DOES exist. strange strange strange... anyone??
 
Here is the Code that causes the 'Cannot access CDO.Message object'
The x's replace my parameters
-----------------------------------------------------------------------------------------------------------------
Dim mail As New System.Web.Mail.MailMessage
mail.To = "(e-mail address removed)"
mail.From = "(e-mail address removed)"
mail.Subject = "this is a test email."
mail.Body = "Some text goes here"

mail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate",
"1") 'basic authentication

mail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendusername",
"xxxxx") 'set your username here

mail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendpassword",
"xxxxxx") 'set your password here
System.Web.Mail.SmtpMail.SmtpServer = "xx.xx.xx.xx" 'your real
server goes here
System.Web.Mail.SmtpMail.Send(mail)
-----------------------
I have the following imports:

Imports System.Web
Imports System.Web.Mail.MailMessage


Your comments

Thanks

Joe
 
Back
Top