469,639 Members | 1,553 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,639 developers. It's quick & easy.

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

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
0 2104

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

2 posts views Thread by Alex Maghen | last post: by
4 posts views Thread by David C | last post: by
1 post views Thread by WIzmanG | last post: by
reply views Thread by gheharukoh7 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.