By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
434,677 Members | 1,069 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 434,677 IT Pros & Developers. It's quick & easy.

System.net.mail.SmtpClient send generates a Syntax error, command unrecognized

P: n/a
Hi,

Have hunted around on the groups and can't find anything, hence.

I've tried this against 2 mail servers (mailtraq and hmailserver) and
it occus with both.

The problems seems to be that when the SMTPClient attaches to the
server and the server sends it greeting message, if anything other than
+OK is received by the client it throws an exception and falls over.
Catching the exception is OK, but the client still falls over.

the hmailServer sends :
+OK POP3
the Mailtraq server sends :
+OK <3148.13349250@MyBoxready for action (Mailtraq
2.8.0.2048/POP3)

and in both cases the SMTPClient blows up in the same way. Is this
class a bit flaky / basic or am I missing something??

During my hunting around on the web people had mentioned creating an
app.exe.config file to capture some logging information, below is the
log I get when I run the app.

System.Net Verbose: 0 : [3680] SmtpClient::.ctor(host=Sage003260,
port=110)
System.Net Information: 0 : [3680] Associating SmtpClient#10549531 with
SmtpTransport#27836922
System.Net Verbose: 0 : [3680] Exiting SmtpClient::.ctor() ->
SmtpClient#10549531
System.Net Verbose: 0 : [3680]
SmtpClient#10549531::Send(MailMessage#49205706)
System.Net Information: 0 : [3680]
SmtpClient#10549531::Send(DeliveryMethod=Network)
System.Net Information: 0 : [3680] Associating SmtpClient#10549531 with
MailMessage#49205706
System.Net Information: 0 : [3680] Associating SmtpTransport#27836922
with SmtpConnection#40198173
System.Net Information: 0 : [3680] Associating SmtpConnection#40198173
with ServicePoint#26239245
System.Net Information: 0 : [3680] Associating SmtpConnection#40198173
with SmtpPooledStream#34826618
System.Net Error: 0 : [3680] Exception in the SmtpClient#10549531::Send
- Syntax error, command unrecognized. The server response was: POP3
System.Net Error: 0 : [3680] at
System.Net.Mail.SmtpConnection.GetConnection(Strin g host, Int32 port)
at System.Net.Mail.SmtpTransport.GetConnection(String host, Int32
port)
at System.Net.Mail.SmtpClient.GetConnection()
at System.Net.Mail.SmtpClient.Send(MailMessage message)
System.Net Verbose: 0 : [3680] Exiting SmtpClient#10549531::Send()

>From home (where I don't have the plethora of firewalls like at work) I
tried to connect to an external email server on my website, which is
hosted at 1-and-1 on a unix box. The SMTPClient worked perfectly well
against that server ( don't know what it is - guessing sendmail).
So my question is, has anybody run into the problem of a non-standard
greeting from an SMTP mail server causing their SMTPClient to top
itself? and If so, what's the work around please.

I considered trying to derive a new class from the SMTPClient that
makes it a little for flexible, but I'm not having much joy so far and
timescales are getting tight - as usual.

TIA

Regards
Howard

Sep 7 '06 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.