Sending Email in C# 2005

pendragon

Well-known member
Joined
Aug 20, 2003
Messages
207
Location
Cambridgeshire
Hi All

Am trying to send email from a program written in c# VS2005, using the following code.

Code:
SmtpClient mailClient = new SmtpClient(SMTPServer);
mailClient.UseDefaultCredentials = true;

MailAddress from = new MailAddress(emailFrom);
MailAddress to = new MailAddress(emailTo);
MailMessage message = new MailMessage(from, to);
message.Subject = emailSubject;
message.Body = emailBody;

mailClient.Send(message);

When it tries to send I get the following error

System.Net.Mail.SmtpException was unhandled
Message="Command not implemented. The server response was: Sorry no ESMTP"

Anyone know what this means please?

Thank You
 
It looks as though the SMTP class in .Net is actually using ESMTP (basically extensions to SMTP and a very common format these days) but the server in question doesnt support it.

What version / make is the SMTP server in question?
 
Hi PlausiblyDamp

Thank you for your reply.

First sorry for putting this in the wrong section.

The server is an old version (1997 I think) of TFS Post Office, I think that you are right and it does not support ESMTP, have emailed the company that makes it but not had a reply to this question.

They did say that the new version is ESMTP compliant to some extent in that It supports 2 ESMTP parameters at the moment and those are "8BITMIME" and the "SIZE" parameter.

Is there anyway that you know of that I can default the SMTP Class to use SMTP and not ESMTP.

If not is there any documentation that you (or anyone else) knows of that can tell me what it would expect from the server to recognise it as an ESMTP server so that I can check to see if upgrading will work. (I know it is a lot to ask but have been searching the Net for 2 days now and am at my wits end)

Thank you for your time
 
Not been able to find much on the SmtpClass that gives any information about dealing with SMTP / ESMTP servers....

Easiest way to check if the server supports ESMTP is to telnet into it on Port 25 and type EHLO - if it responds with an OK then it is ESMTP, if it errors but responds when you do HELO then it only supports SMTP.
 
Thanks for that PlausiblyDamp, you are right telnet comes up with an error when I send that command, so it does not support ESMTP.

What I think I shall do is get the upgrade and see if the new version works with it.

Hopefully Microsoft will publish some more detailed information on the SMTP class at some point

Thanks again for your time.
 
This isnt a new problem; Ive seen free mailers for C# in the past. A little searching should turn something up for SMTP.
 
Back
Top