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("[EMAIL PROTECTED]");
                mail.To.Add("[EMAIL PROTECTED]");

                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("[EMAIL PROTECTED]",
"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 



_______________________________________________
Mono-list maillist  -  [email protected]
http://lists.ximian.com/mailman/listinfo/mono-list

Reply via email to