Hi
I use this code to send a email, it works fine until I try to add an attachment, the I get the "Could not access 'CDO.Message' " error message. I cant see why this shouldn't work. Can anyone help?
regards
I use this code to send a email, it works fine until I try to add an attachment, the I get the "Could not access 'CDO.Message' " error message. I cant see why this shouldn't work. Can anyone help?
Code:
Sub Mailstatistic(ByVal strFileName)
Dim mail As New MailMessage
mail.To = "name@domail.com"
mail.From = "name@domail.com"
mail.Subject = "this is a test email."
mail.BodyFormat = MailFormat.Html
mail.Body = "this is my test email body.<br><b>this part is in bold</b>"
If System.IO.File.Exists("PDF_Files/" & strFileName) Then
MsgBox("yes")
Else
MsgBox("no file")
End If
Dim attachment As New MailAttachment("PDF_Files/" & strFileName) 'create the attachment
mail.Attachments.Add(attachment) 'add the attachment
SmtpMail.SmtpServer = "xxx" 'your real server goes here SmtpMail.Send(mail)
End Sub
regards