[Mono-list] MailMessage Recipients Exceptions

Steve Harp steve at abelscreening.com
Mon Mar 17 13:41:36 EDT 2008


Hi All,

I'm new to the list so please excuse me if this has already been covered.
I'm having trouble sending email.  The code below works under .NET but not
under Mono.  The exception thrown seems to be with the way I'm specifying my
recipients.

private void SendTest()
{
	try
	{
		MailMessage mail = new MailMessage();

		mail.From = new MailAddress("me at mydomain.com");
		mail.To.Add("you at yourdomain.com");

		mail.Subject = "This is a test";
		mail.Body = "This is a test\r\nThis is only a test.";

		SmtpClient smtp = new SmtpClient("smtp.myisp.net", 587);

		smtp.Credentials = new NetworkCredential("me at mydomain.com",
"mypassword");
		smtp.Send(mail);
	}
	catch (Exception ex)
	{
		Log("Error Sending Email", ex);
	}
}

/*
=========================================
Here's the log file...

3/17/2008 1:14:47 PM
Error Sending Email
System.Net.Mail.SmtpFailedRecipientsException: failed recipients
  at System.Net.Mail.SmtpClient.SendCore (System.Net.Mail.MailMessage
message) [0x0048c] in
/tmp/monobuild/build/BUILD/mono-1.9/mcs/class/System/System.Net.Mail/SmtpCli
ent.cs:595
  at System.Net.Mail.SmtpClient.Send (System.Net.Mail.MailMessage message)
[0x00052] in
/tmp/monobuild/build/BUILD/mono-1.9/mcs/class/System/System.Net.Mail/SmtpCli
ent.cs:446
  at MainWindow.SendTest () [0x00061] in MainWindow.cs:64

=========================================
*/


Thanks for any suggestions,
Steve 





More information about the Mono-list mailing list