E-Mailing From A Console App

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
 
B

Bernie Yaeger

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top