I am trying to write code to send a mail message with an attached file.
my code works fine if I don't try to attach a file but crashes when I do. I have not been able to figure this out. My code looks like this.
Dim mail As New MailMessage()
'set the addresses
mail.From = New MailAddress("firstname.lastname@example.org")
'set the content
mail.Subject = "Article to be submitted."
mail.Body = Message
'send the message
Dim smtp As New SmtpClient("smtp.east.cox.net")
smtp.Port = 25
smtp.EnableSsl = True
smtp.Credentials = New System.Net.NetworkCredential("xxx", "xxx")
What am I doing wrong?