2007-10-16 Atsushi Enomoto <atsushi@ximian.com>
authorAtsushi Eno <atsushieno@gmail.com>
Tue, 16 Oct 2007 07:06:34 +0000 (07:06 -0000)
committerAtsushi Eno <atsushieno@gmail.com>
Tue, 16 Oct 2007 07:06:34 +0000 (07:06 -0000)
* SmtpClient.cs : Replace every \r and \n with \r\n per RFC 2821
  section 2.3.7, or you will receive SMTP error 451.

svn path=/trunk/mcs/; revision=87558

mcs/class/System/System.Net.Mail/ChangeLog
mcs/class/System/System.Net.Mail/SmtpClient.cs

index 8d589ad70e7ba6fa4efdf3e54510c739a68787db..bad18027e5ef64033fcfaef7fe7bc993d14d1bca 100644 (file)
@@ -1,3 +1,8 @@
+2007-10-16  Atsushi Enomoto  <atsushi@ximian.com>
+
+       * SmtpClient.cs : Replace every \r and \n with \r\n per RFC 2821 
+         section 2.3.7, or you will receive SMTP error 451.
+
 2007-10-16  Atsushi Enomoto  <atsushi@ximian.com>
 
        * AlternateViewCollection.cs, LinkedResourceCollection.cs,
index 4cda4db26a66c994b4f7c7ccdf6bdeb1e5a0bf1f..ba192fffb94fa2519a445ebd60989b2cab0ea397 100644 (file)
@@ -484,8 +484,10 @@ namespace System.Net.Mail {
 
                private void SendData (string data)
                {
-                       writer.Write (data);
                        // Certain SMTP servers will reject mail sent with unix line-endings; see http://cr.yp.to/docs/smtplf.html
+                       writer.Write (data.Replace ("\r\n", "\n")
+                                         .Replace ('\r', '\n')
+                                         .Replace ("\n", "\r\n"));
                        writer.Write ("\r\n");
                        writer.Flush ();
                }