Fix the date time set in file by removing the ':'.
authoryjoly <yannick.joly@croesus.com>
Tue, 15 Apr 2014 19:41:40 +0000 (15:41 -0400)
committeryjoly <yannick.joly@croesus.com>
Tue, 15 Apr 2014 19:41:40 +0000 (15:41 -0400)
This is the same code than the one under SendCore. The date time should
not have the : (time zone offset) to be able to use the file.

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

index 5b496e14ce55587de1c814557d30cfd9afce411c..b151571620f12969ebab482469964ec5b285f772 100644 (file)
@@ -547,8 +547,12 @@ namespace System.Net.Mail {
                                MailAddress from = message.From;
                                if (from == null)
                                        from = defaultFrom;
-                               
-                               SendHeader (HeaderName.Date, DateTime.Now.ToString ("ddd, dd MMM yyyy HH':'mm':'ss zzz", DateTimeFormatInfo.InvariantInfo));
+
+                               string dt = DateTime.Now.ToString("ddd, dd MMM yyyy HH':'mm':'ss zzz", DateTimeFormatInfo.InvariantInfo);
+                               // remove ':' from time zone offset (e.g. from "+01:00")
+                               dt = dt.Remove(dt.Length - 3, 1);
+                               SendHeader(HeaderName.Date, dt);
+
                                SendHeader (HeaderName.From, EncodeAddress(from));
                                SendHeader (HeaderName.To, EncodeAddresses(message.To));
                                if (message.CC.Count > 0)