Hi all,
I have the following code for performing an e-mail message:
Dim mailMsg As New MailMessage
With mailMsg
.From = "DailyMaintenanceReport@wh
oever.com"
.To = "whoever@whoever.com"
.Subject = "Daily Maintenance Report as of " & Now
.Body = "Attached is your daily report"
.Attachments.Add("C:\Test\
Book1.doc"
)
End With
SmtpMail.SmtpServer = "CorportateSMTPServer"
Try
' Dim x As Integer
SmtpMail.Send(mailMsg)
Catch exp As Exception
TextBox1.Text = exp.Message
MsgBox("Ugh Oh")
End Try
My delimma is, the code works great, until the attachment is added to the message. Once the attachment is added, I get the following message:
Specified cast is not valid.
Any help would be greatly appreciated. Thanks in advance.
Start Free Trial