Hey guys,
I'm try to write a very simple winform app that allows the users to send an
email. I use the System.Web.Mail MailMessage class for this.
But when it comes to adding an attachment, something appears to go wrong.
After I execute the following code, the MailMessage appears to have an
attachment (looked it up through a watch in debug mode), but when I actually
send the message, the attachment is not send along with it. So the message
arrives in my inbox, but without the attachment. What am I doing wrong,
Many thanks,
Bart
public void AddAttachment (string file)
{
MailAttachment bijlage = new MailAttachment(file,MailEncoding.Base64);
if (!message.Attachments.Contains(bijlage))
{
message.Attachments.Add(bijlage);
}
}