[Mono-dev] SmtpClient only supports ESMTP?

Mads Bondo Dydensborg mbd at dbc.dk
Thu May 31 06:40:16 EDT 2007

onsdag 30 maj 2007 23:52 skrev Jeffrey Stedfast:
> On Wed, 2007-05-30 at 12:12 +0200, Mads Bondo Dydensborg wrote:
> > Hi there
> > 
> > Regrettable I "crashed" into a smtp server today, that does not support 
> > but only SMTP (some old kind of exchange server, I think).
> > 
> > It seems that System.Net.Mail.SmtpClient only supports ESMTP - is this 
> > Any plans for supporting SMTP also?
> I've just committed a fix to make it work for non-ESMTP servers (as well
> as a few fixes for other low-hanging fruit that I spotted while browsing
> thru the code).


Thanks a lot. 

An additional bit of information: Turns out the SMTP server I was talking to, 
is a piece of anti-virus software running in front of the real mail server. 
Just to clear Exchange of any accusations on my part. Also, the program I am 
running is nlog (nlog-project.org) which is compiled to use 
System.Net.Mail.SmtpClient. Makes a bit annoying to try and use another 

However, your fix does not work with the SMTP "server" I am running against. 
Here is a stacktrace:

2007-05-31 12:00:15.5294 Error Target exception: 
System.Net.Mail.SmtpException: 500 Syntax error, command unrecognized
  at System.Net.Mail.SmtpClient.Authenticate (System.String Username, 
System.String Password) [0x000a4] 
in /home/compile/Compile/Mono/mcs/class/System/System.Net.Mail/Smtp
  at System.Net.Mail.SmtpClient.PerformAuthentication () [0x00074] 
in /home/compile/Compile/Mono/mcs/class/System/System.Net.Mail/SmtpClient.cs:657
  at System.Net.Mail.SmtpClient.Send (System.Net.Mail.MailMessage message) 
in /home/compile/Compile/Mono/mcs/class/System/System.Net.Mail/SmtpClient.cs:308
The "server" does not support authentication. Looking at the code, it seem 
there are a couple of FIXME related to this. A question: if the code has to 
fall back on HELO, can we safely assume that no extensions exists? My 
understanding of SMTP suggests this. This could be a quick fix for the SMTP 
case, although auth and other still needs to be determined for the ESMTP 

Attached is a patch against current svn that does exactly this: for ESMTP it 
assumes that Auth and TLS works (as now), for SMTP it assumes they do not. 
This fixes my problem (mail is now beeing sent, and received), but is 
untested on real ESMTP servers (don't have one handy, would require some 
firewall fiddling). Please let me know if you can accept this almost trivial 



> Jeff
> _______________________________________________
> Mono-devel-list mailing list
> Mono-devel-list at lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/mono-devel-list

Med venlig hilsen/Regards

Systemudvikler/Systemsdeveloper cand.scient.dat, Ph.d., Mads Bondo Dydensborg
Dansk BiblioteksCenter A/S, Tempovej 7-11, 2750 Ballerup, Tlf. +45 44 86 77 34
-------------- next part --------------
A non-text attachment was scrubbed...
Name: SmtpClient.cs.patch
Type: text/x-diff
Size: 1156 bytes
Desc: not available
Url : http://lists.ximian.com/pipermail/mono-devel-list/attachments/20070531/27c7754f/attachment.bin 

More information about the Mono-devel-list mailing list