[Mono-list] Tiny patch for System.Web.Mail
Elan Feingold
efeingold@mn.rr.com
Thu, 27 Feb 2003 20:13:37 -0600
This is a multi-part message in MIME format.
------=_NextPart_000_0158_01C2DE9C.B701AD00
Content-Type: multipart/alternative;
boundary="----=_NextPart_001_0159_01C2DE9C.B708D8F0"
------=_NextPart_001_0159_01C2DE9C.B708D8F0
Content-Type: text/plain;
charset="us-ascii"
Content-Transfer-Encoding: 7bit
First of all, this is awesome! I updated and my program that had been
erroring out on sending mail now sends mail!!! Nice work!!!
Some SMTP servers return something like:
220-mail4.mn.rr.com Microsoft SMTP MAIL ready at Thu, 27 Feb 2003
20:01:23 -0600 Version:
220 ESMTP spoken here
Note the "-" character in the fourth place. So the code could either
check the next line or be content with a "-" character in there.
Also, just as a note, the MS implementation accepts:
MailMessage message = new MailMessage();
message.From = "foo@bar.com (The Foomeister)";
Note the name in parenthesis. My guess (I haven't checked) is that the
MS impl. strips out everything but the actual email address to pass to
the SMTP server.
-elan
------=_NextPart_001_0159_01C2DE9C.B708D8F0
Content-Type: text/html;
charset="us-ascii"
Content-Transfer-Encoding: quoted-printable
<html>
<head>
<META HTTP-EQUIV=3D"Content-Type" CONTENT=3D"text/html; =
charset=3Dus-ascii">
<meta name=3DGenerator content=3D"Microsoft Word 10 (filtered)">
<style>
<!--
/* Font Definitions */
@font-face
{font-family:Georgia;
panose-1:2 4 5 2 5 4 5 2 3 3;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0in;
margin-bottom:.0001pt;
font-size:12.0pt;
font-family:"Times New Roman";}
a:link, span.MsoHyperlink
{color:blue;
text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
{color:purple;
text-decoration:underline;}
span.EmailStyle17
{font-family:Georgia;
color:windowtext;
font-weight:normal;
font-style:normal;
text-decoration:none none;}
@page Section1
{size:8.5in 11.0in;
margin:1.0in 1.25in 1.0in 1.25in;}
div.Section1
{page:Section1;}
-->
</style>
</head>
<body lang=3DEN-US link=3Dblue vlink=3Dpurple>
<div class=3DSection1>
<p class=3DMsoNormal><font size=3D2 face=3DGeorgia><span =
style=3D'font-size:10.0pt;
font-family:Georgia'>First of all, this is awesome! I updated and my =
program
that had been erroring out on sending mail now sends mail!!! Nice =
work!!!</span></font></p>
<p class=3DMsoNormal><font size=3D2 face=3DGeorgia><span =
style=3D'font-size:10.0pt;
font-family:Georgia'> </span></font></p>
<p class=3DMsoNormal><font size=3D2 face=3DGeorgia><span =
style=3D'font-size:10.0pt;
font-family:Georgia'>Some SMTP servers return something =
like:</span></font></p>
<p class=3DMsoNormal><font size=3D2 face=3DGeorgia><span =
style=3D'font-size:10.0pt;
font-family:Georgia'> </span></font></p>
<p class=3DMsoNormal><font size=3D2 face=3DGeorgia><span =
style=3D'font-size:10.0pt;
font-family:Georgia'>220-mail4.mn.rr.com Microsoft SMTP MAIL ready at =
Thu, </span></font><font size=3D2 face=3DGeorgia><span =
style=3D'font-size:10.0pt;font-family:Georgia'>27 Feb =
2003</span></font><font
size=3D2 face=3DGeorgia><span =
style=3D'font-size:10.0pt;font-family:Georgia'> </span></font><font =
size=3D2 face=3DGeorgia><span =
style=3D'font-size:10.0pt;font-family:Georgia'>20:01:23</span></font><fon=
t
size=3D2 face=3DGeorgia><span =
style=3D'font-size:10.0pt;font-family:Georgia'> -0600
Version:</span></font></p>
<p class=3DMsoNormal><font size=3D2 face=3DGeorgia><span =
style=3D'font-size:10.0pt;
font-family:Georgia'>220 ESMTP spoken here</span></font></p>
<p class=3DMsoNormal><font size=3D2 face=3DGeorgia><span =
style=3D'font-size:10.0pt;
font-family:Georgia'> </span></font></p>
<p class=3DMsoNormal><font size=3D2 face=3DGeorgia><span =
style=3D'font-size:10.0pt;
font-family:Georgia'>Note the “-“ character in the fourth =
place. So
the code could either check the next line or be content with a =
“-“
character in there.</span></font></p>
<p class=3DMsoNormal><font size=3D2 face=3DGeorgia><span =
style=3D'font-size:10.0pt;
font-family:Georgia'> </span></font></p>
<p class=3DMsoNormal><font size=3D2 face=3DGeorgia><span =
style=3D'font-size:10.0pt;
font-family:Georgia'>Also, just as a note, the MS implementation =
accepts:</span></font></p>
<p class=3DMsoNormal><font size=3D2 face=3DGeorgia><span =
style=3D'font-size:10.0pt;
font-family:Georgia'> </span></font></p>
<p class=3DMsoNormal style=3D'text-autospace:none'><font size=3D2 =
face=3D"Courier New"><span
style=3D'font-size:10.0pt;font-family:"Courier New"'>MailMessage message =
=3D <font
color=3Dblue><span style=3D'color:blue'>new</span></font> =
MailMessage();</span></font></p>
<p class=3DMsoNormal><font size=3D2 face=3D"Courier New"><span =
style=3D'font-size:10.0pt;
font-family:"Courier New"'>message.From =3D “foo@bar.com (The =
Foomeister)”;</span></font></p>
<p class=3DMsoNormal><font size=3D2 face=3D"Courier New"><span =
style=3D'font-size:10.0pt;
font-family:"Courier New"'> </span></font></p>
<p class=3DMsoNormal><font size=3D2 face=3DGeorgia><span =
style=3D'font-size:10.0pt;
font-family:Georgia'>Note the name in parenthesis. My guess (I =
haven’t
checked) is that the MS impl. strips out everything but the actual email
address to pass to the SMTP server.</span></font></p>
<p class=3DMsoNormal><font size=3D2 face=3DGeorgia><span =
style=3D'font-size:10.0pt;
font-family:Georgia'> </span></font></p>
<p class=3DMsoNormal><font size=3D2 face=3DGeorgia><span =
style=3D'font-size:10.0pt;
font-family:Georgia'>-elan</span></font></p>
</div>
</body>
</html>
------=_NextPart_001_0159_01C2DE9C.B708D8F0--
------=_NextPart_000_0158_01C2DE9C.B701AD00
Content-Type: application/octet-stream;
name="patch"
Content-Transfer-Encoding: quoted-printable
Content-Disposition: attachment;
filename="patch"
Index: class/System.Web/System.Web.Mail/SmtpResponse.cs=0A=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=0A=
RCS file: /mono/mcs/class/System.Web/System.Web.Mail/SmtpResponse.cs,v=0A=
retrieving revision 1.2=0A=
diff -u -r1.2 SmtpResponse.cs=0A=
--- class/System.Web/System.Web.Mail/SmtpResponse.cs 23 Feb 2003 =
21:22:18 -0000 1.2=0A=
+++ class/System.Web/System.Web.Mail/SmtpResponse.cs 28 Feb 2003 =
01:59:53 -0000=0A=
@@ -40,7 +40,7 @@=0A=
throw new SmtpException( "Response is to short " + =0A=
line.Length + ".");=0A=
=0A=
- if( line[ 3 ] !=3D ' ' )=0A=
+ if( line[ 3 ] !=3D ' ' && line[ 3 ] !=3D '-')=0A=
throw new SmtpException( "Response format is wrong.(" + =0A=
line + ")" );=0A=
=0A=
------=_NextPart_000_0158_01C2DE9C.B701AD00--