E-Mailing From A Console App

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have the following Code in a Windows App (reference to System.Web.dll)

Dim Message As System.Web.Mail.MailMessage = New System.Web.Mail.MailMessage()
Dim smtpmail As System.Web.Mail.SmtpMail
smtpmail.SmtpServer = "129.41.70.10"

'strOrderInfo = BuildBody()

Message.To = "(e-mail address removed)"
Message.From = "(e-mail address removed)"
Message.Body = "Testing"
Message.Subject = "Hope This Works"

Try
smtpmail.Send(Message)
Catch ex As Exception
Dim s As String = ex.Message
End Try

It works fine in a Windows App. In My ConsoleApp, I'm catching an error

_message "Could not access 'CDO.Message' object." String

Any help here. The code is the exact same.

Ed
 
Hi Ed,

Google is full of answers to the dreaded 'cdo message object'. I've got to
think that the .net framework has a bug or 2 here, but I've found that I
overcome this error in a console app using localhost as 127.0.0.1 instead as
the smtpserver.

HTH,

Bernie Yaeger
 
Back
Top