send a .jpg using smtp from windows forms application in C#
Posted on 2004-10-04
below is the smtp code i am using, i got the exceptions
'System.Web.HttpException' occurred in system.web.dll
Additional information: Could not access 'CDO.Message' object.
so in smtp virtual server properties->Access->relay selected 'all except the list below' and both above exceptions went away
but still no email was sent by the code when i checked my hotmail account
i tried using both the strings for SmtpServer = "127.0.0.1"; //"localhost"
MailMessage mail = new MailMessage();
mail.To = "firstname.lastname@example.org";
mail.From = "email@example.com";
mail.Subject = "this is a test email.";
mail.Body = "this is my test email body.";
MailAttachment attachment = new MailAttachment( @"D:\1\trial\ProjectWorkSpace5\3769.jpg" ); mail.Attachments.Add( attachment );
SmtpMail.SmtpServer = "127.0.0.1"; //"localhost"
SmtpMail.Send( mail );
now why would it not send the email?! ....thank you in advance for your assistance