Email Question

runswithsizzors

Well-known member
Joined
May 11, 2005
Messages
70
Location
Northern Michigan
Programming Experience
5-10
Email Question - Thanks!

Not sure if this is the right place to ask this but I am having problems sending emails from winforms and I am sure the code is right. I get a can't access CDO.Message error or something like that. Another question I have what if the SMTP server you are accessing needs authentication is there any way to do that?

Dim ms As MailMessage = New MailMessage
ms.From = FromBox.Text.ToString
ms.To = ToBox.Text.ToString
ms.Subject = SubjectBox.Text.ToString
ms.Body = BodyBox.Text.ToString
SmtpMail.SmtpServer = "a smtp server"

Try
SmtpMail.Send(ms)
Catch ex As Exception
MessageBox.Show(ex.Message)
EndTry

I am sure this code is right from the examples I have seen but any suggestions to lead me in the right place, thanks!
 
Last edited:
Back
Top