[Mono-list] Exception When Using System.Net.Mail
Atsushi Eno
atsushi at ximian.com
Wed Dec 5 06:49:59 EST 2007
Hi,
SmtpClient has been improved between 1.2.5 and 1.2.6beta (and
possibly between 1.2.4 and 1.2.5) and now it seems working now.
(AFAIR there was a bug in former SmtpClient that incorrectly
assumes NetworkCredential existence even without setting it.)
Atsushi Eno
Kenneth H. Brannigan wrote:
> I am getting the following exception when using System.Net.Mail in mono
> 1.2.4_4:
>
> Unhandled Exception: System.Net.Mail.SmtpException: 500 5.5.1 Command
> unrecognized: "AUTH LOGIN"
> at System.Net.Mail.SmtpClient.Authenticate (System.String Username,
> System.String Password) [0x00000]
> at System.Net.Mail.SmtpClient.PerformAuthentication () [0x00000]
> at System.Net.Mail.SmtpClient.Send (System.Net.Mail.MailMessage
> message) [0x00000]
> at MonoTestConsoleApplication.Program.Main (System.String[] args)
> [0x00000]
>
> Here is the code:
>
> System.Net.Mail.MailMessage message = new
> System.Net.Mail.MailMessage("admin at test.com <mailto:admin at test.com>",
> "sent at test.com <mailto:sent at test.com>");
> message.Subject = "Test From Mono";
> message.Body = "<b>THIS IS COOL</b>";
> message.IsBodyHtml = true;
>
> System.Net.Mail.SmtpClient server = new
> System.Net.Mail.SmtpClient("localhost");
> server.DeliveryMethod =
> System.Net.Mail.SmtpDeliveryMethod.Network;
> server.Send(message);
>
> When I run the following code using the old System.Web.Mail namespace it
> works perfectly:
>
> System.Web.Mail.MailMessage oldMessage = new
> System.Web.Mail.MailMessage();
> oldMessage.To = "sent at test.com <mailto:sent at test.com>";
> oldMessage.From = "admin at test.com <mailto:admin at test.com>";
> oldMessage.Subject = "OLD MONO";
> oldMessage.BodyFormat = System.Web.Mail.MailFormat.Html;
> oldMessage.Body = "<b>THIS IS COOL</B>";
>
> System.Web.Mail.SmtpMail.SmtpServer = "localhost";
> System.Web.Mail.SmtpMail.Send(oldMessage);
>
>
> Any help will be very much appreciated.
> Thanks,
> Ken
>
>
> *Kenneth H. Brannigan*
> CTO
>
>
>
> *Vitruvian Solutions®, LLC*
> Mobile: 201.602.6542
> E-mail: kbrannigan at vitruviansolutions.com
> <mailto:kbrannigan at vitruviansolutions.com>
> Web: www.vitruviansolutions.com <http://www.vitruviansolutions.com>
>
>
>
> The contents of this e-mail are privileged and confidential. This e-mail
> is intended to be read only by the individual(s) or entity to whom it is
> addressed. If you are not the intended recipient of this e-mail, please
> notify the sender and delete the e-mail. Any review, retransmission,
> dissemination, copying or other use of this e-mail or its contents is
> strictly prohibited.
>
>
>
>
>
>
>
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> Mono-list maillist - Mono-list at lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/mono-list
More information about the Mono-list
mailing list