473,686 Members | 2,107 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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::.ct or(host=Sage003 260,
port=110)
System.Net Information: 0 : [3680] Associating SmtpClient#1054 9531 with
SmtpTransport#2 7836922
System.Net Verbose: 0 : [3680] Exiting SmtpClient::.ct or() ->
SmtpClient#1054 9531
System.Net Verbose: 0 : [3680]
SmtpClient#1054 9531::Send(Mail Message#4920570 6)
System.Net Information: 0 : [3680]
SmtpClient#1054 9531::Send(Deli veryMethod=Netw ork)
System.Net Information: 0 : [3680] Associating SmtpClient#1054 9531 with
MailMessage#492 05706
System.Net Information: 0 : [3680] Associating SmtpTransport#2 7836922
with SmtpConnection# 40198173
System.Net Information: 0 : [3680] Associating SmtpConnection# 40198173
with ServicePoint#26 239245
System.Net Information: 0 : [3680] Associating SmtpConnection# 40198173
with SmtpPooledStrea m#34826618
System.Net Error: 0 : [3680] Exception in the SmtpClient#1054 9531::Send
- Syntax error, command unrecognized. The server response was: POP3
System.Net Error: 0 : [3680] at
System.Net.Mail .SmtpConnection .GetConnection( String host, Int32 port)
at System.Net.Mail .SmtpTransport. GetConnection(S tring host, Int32
port)
at System.Net.Mail .SmtpClient.Get Connection()
at System.Net.Mail .SmtpClient.Sen d(MailMessage message)
System.Net Verbose: 0 : [3680] Exiting SmtpClient#1054 9531::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 2400

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
57645
by: HoustonComputerGuy | last post by:
I am working on getting my web applications moved to .Net 2.0 and am having some problems with System.Net.Mail. I get the following error when sending the mail: System.Net.Mail.SmtpException was unhandled by user code Message="Failure sending mail." Source="System" StackTrace: at System.Net.Mail.SmtpClient.Send(MailMessage message) at System.Net.Mail.SmtpClient.Send(String from, String
1
8176
by: Eric Sheu | last post by:
Greetings, I have been searching the web like mad for a solution to my SMTP problem. I am using Windows Server 2003 and ASP.NET 2.0 w/ C# to send out e-mails from a web site I have created to the members of my organization. I think my problem is incorrectly setting the settings on my server or an authentication problem. Here is the code I have written to send a test message: -----Code Begins: Sensitive Information Replaced by -----...
2
2155
by: Alex Maghen | last post by:
I want to use the new System.Net.Mail instead of the old System.Web.Mail. I'm getting an error "Hot not specified" when I try to do my last two lines: System.Net.Mail.SmtpClient SMTP = new SmtpClient(); SMTP.Send(Message); //Error happens here But the thing is, in my old use of System.Web.Mail, I never had this problem. Why do I HAVE to specify the host in the new version and I didn't
2
17475
by: clevrmnkey | last post by:
I've had nothing but trouble from the System.Net.Mail objects, but I finally need to make them work, and I can't for the life of me see what I'm doing wrong. I pared back my mail transaction to the bare minimum: System.Net.Mail.SmtpClient smtp = new System.Net.Mail.SmtpClient("<my mail server IP>", 25); smtp.Send("<one of my email addresses>", "<another of my email addresses>", "Hello", "World");
1
5148
by: les | last post by:
I'm getting this error "BC30456: 'IsBodyHtml' is not a member of 'System.Net.Mail.SmtpClient'" when trying to submit a form and send email. If I remove the line "MailObj.IsBodyHtml = True" the mail sends without error, but html markup is visible in the body of the email. Any suggestions? Code below:
2
6819
by: satnamsarai | last post by:
Using System.Net.Mail: Sometimes I get error 'failure sending mail. Unable to write data to the transport connection: An existing connection was forcibly closed by the remote host.' Not sure how to fix this error. I am able to send messages sometimes both other times randomly following error appear EXCEPTION:
4
2392
by: David C | last post by:
I would like to have an email go to 2 email addresses but when I try it by separating with semicolon or comma it fails. Can anyone help? below is my code (see ToAddress string). Thanks. David strUser = UtilClass.GetUserName(strUser) '!!! UPDATE THIS VALUE TO YOUR EMAIL ADDRESS Const ToAddress As String = "me@myemail.com" Const FromAddress As String = "me@myemail.com"
1
3272
by: WIzmanG | last post by:
Hi all I am having trouble with sending email via a C#2.0 application, I use the same settings as I use in Outlook but I cannot get email to send. I am trying to use SSL on port 465 and get the error below, If I disable SSL and use port 587 all goes well. I have been Googling for 2 days without success and this seems to be a common problem.
2
3832
by: btcoder | last post by:
Hi, my jsp page uses sun.net.smtp.SmtpClient to send email. It worked fine until the hosted location was moved to another server. Now it generates the sun.net.smtp.SmtpProtocolException and the hosting company can't find what's wrong with it so I'm here hoping somebody can help. The hosting company tried sending email from the server and it was okay and found no restrictions that prevents my page to access the smtp server. What could cause...
0
8585
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8517
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
1
8770
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
1
6441
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5800
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4309
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
2947
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2208
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
1940
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.