473,770 Members | 6,348 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

SMTP Sending Issue

I'm having issues sending an email to an "@page.nextel.c om" email
address. I can send to any other email address fine, but when I try
the page.nextel.com it gives me this error:

Final-Recipient: XX*****@page.ne xtel.com
Diagnostic-Code: smtp; 554 message body contains illegal bare CR/LF
characters.
Action: failed
Status: 5.0.0

I think it has something to do with the headers that are being sent.
All I have in the subject and body is the word "test." Using this
same SMTP relay, I can get a PHP script to send an email if I strip
out all the headers. Whenever I send via MailMessage/SmtpClient it
fails. I've tried using the MailMessage.hea ders.clear(), but no
success.

Here is my code:

MailMessage mess = new MailMessage(txt From.Text,
txtTo.Text);
mess.Subject = "Test Message";
mess.Body = "Test Message";
mess.Headers.Ad d("From", txtFrom.Text);
mess.Headers.Ad d("To", txtTo.Text);
SmtpClient client = new SmtpClient(smtp Server, 25);
client.Send(mes s);
mess.Dispose();
Thanks
Marty
Jun 27 '08 #1
8 3807
Try specifying an Encoding in your Message. I had problems with SMTP in the
past and it was solved (in part) by setting the Encoding.

"Marty" wrote:
I'm having issues sending an email to an "@page.nextel.c om" email
address. I can send to any other email address fine, but when I try
the page.nextel.com it gives me this error:

Final-Recipient: XX*****@page.ne xtel.com
Diagnostic-Code: smtp; 554 message body contains illegal bare CR/LF
characters.
Action: failed
Status: 5.0.0

I think it has something to do with the headers that are being sent.
All I have in the subject and body is the word "test." Using this
same SMTP relay, I can get a PHP script to send an email if I strip
out all the headers. Whenever I send via MailMessage/SmtpClient it
fails. I've tried using the MailMessage.hea ders.clear(), but no
success.

Here is my code:

MailMessage mess = new MailMessage(txt From.Text,
txtTo.Text);
mess.Subject = "Test Message";
mess.Body = "Test Message";
mess.Headers.Ad d("From", txtFrom.Text);
mess.Headers.Ad d("To", txtTo.Text);
SmtpClient client = new SmtpClient(smtp Server, 25);
client.Send(mes s);
mess.Dispose();
Thanks
Marty
Jun 27 '08 #2
On Jun 10, 2:26 pm, jp2msft <jp2m...@discus sions.microsoft .comwrote:
Try specifying an Encoding in your Message. I had problems with SMTP in the
past and it was solved (in part) by setting the Encoding.

"Marty" wrote:
I'm having issues sending an email to an "@page.nextel.c om" email
address. I can send to any other email address fine, but when I try
the page.nextel.com it gives me this error:
Final-Recipient: XXXX...@page.ne xtel.com
Diagnostic-Code: smtp; 554 message body contains illegal bare CR/LF
characters.
Action: failed
Status: 5.0.0
I think it has something to do with the headers that are being sent.
All I have in the subject and body is the word "test." Using this
same SMTP relay, I can get a PHP script to send an email if I strip
out all the headers. Whenever I send via MailMessage/SmtpClient it
fails. I've tried using the MailMessage.hea ders.clear(), but no
success.
Here is my code:
MailMessage mess = new MailMessage(txt From.Text,
txtTo.Text);
mess.Subject = "Test Message";
mess.Body = "Test Message";
mess.Headers.Ad d("From", txtFrom.Text);
mess.Headers.Ad d("To", txtTo.Text);
SmtpClient client = new SmtpClient(smtp Server, 25);
client.Send(mes s);
mess.Dispose();
Thanks
Marty
What encoding should I try? UTF8, Unicode, or UTF3....

Jun 27 '08 #3
Marty <ma***********@ gmail.comwrote in news:54762a45-d5fc-4eaf-bb44-
5e**********@e5 3g2000hsa.googl egroups.com:
Diagnostic-Code: smtp; 554 message body contains illegal bare CR/LF
characters.
That suggests that there's a bug in SmtpClient.Send . The error message is
probably from the Postfix mail server and is saying that there's either a
LF or CR by itself on the end of a line. SMTP requires that lines end with
a CR followed by a LF.

Where does the SmtpClient class come from?

See section 2.3.7 (Lines) here:

http://www.faqs.org/rfcs/rfc2821
Jun 27 '08 #4
Start with Unicode. I think more things are supposed to be going to that.

"Marty" wrote:
On Jun 10, 2:26 pm, jp2msft <jp2m...@discus sions.microsoft .comwrote:
Try specifying an Encoding in your Message. I had problems with SMTP in the
past and it was solved (in part) by setting the Encoding.

"Marty" wrote:
I'm having issues sending an email to an "@page.nextel.c om" email
address. I can send to any other email address fine, but when I try
the page.nextel.com it gives me this error:
Final-Recipient: XXXX...@page.ne xtel.com
Diagnostic-Code: smtp; 554 message body contains illegal bare CR/LF
characters.
Action: failed
Status: 5.0.0
I think it has something to do with the headers that are being sent.
All I have in the subject and body is the word "test." Using this
same SMTP relay, I can get a PHP script to send an email if I strip
out all the headers. Whenever I send via MailMessage/SmtpClient it
fails. I've tried using the MailMessage.hea ders.clear(), but no
success.
Here is my code:
MailMessage mess = new MailMessage(txt From.Text,
txtTo.Text);
mess.Subject = "Test Message";
mess.Body = "Test Message";
mess.Headers.Ad d("From", txtFrom.Text);
mess.Headers.Ad d("To", txtTo.Text);
SmtpClient client = new SmtpClient(smtp Server, 25);
client.Send(mes s);
mess.Dispose();
Thanks
Marty

What encoding should I try? UTF8, Unicode, or UTF3....

Jun 27 '08 #5
On Jun 10, 2:44 pm, Marty <marty.wass...@ gmail.comwrote:
On Jun 10, 2:26 pm, jp2msft <jp2m...@discus sions.microsoft .comwrote:
Try specifying an Encoding in your Message. I had problems with SMTP in the
past and it was solved (in part) by setting the Encoding.
"Marty" wrote:
I'm having issues sending an email to an "@page.nextel.c om" email
address. I can send to any other email address fine, but when I try
the page.nextel.com it gives me this error:
Final-Recipient: XXXX...@page.ne xtel.com
Diagnostic-Code: smtp; 554 message body contains illegal bare CR/LF
characters.
Action: failed
Status: 5.0.0
I think it has something to do with the headers that are being sent.
All I have in the subject and body is the word "test." Using this
same SMTP relay, I can get a PHP script to send an email if I strip
out all the headers. Whenever I send via MailMessage/SmtpClient it
fails. I've tried using the MailMessage.hea ders.clear(), but no
success.
Here is my code:
MailMessage mess = new MailMessage(txt From.Text,
txtTo.Text);
mess.Subject = "Test Message";
mess.Body = "Test Message";
mess.Headers.Ad d("From", txtFrom.Text);
mess.Headers.Ad d("To", txtTo.Text);
SmtpClient client = new SmtpClient(smtp Server, 25);
client.Send(mes s);
mess.Dispose();
Thanks
Marty

What encoding should I try? UTF8, Unicode, or UTF3....
I tried all encoding types with no luck. Here is the code I used
before the SmtpClient.Send ().

mess.BodyEncodi ng = System.Text.Enc oding.Unicode;
mess.SubjectEnc oding = System.Text.Enc oding.Unicode;
Jun 27 '08 #6
Kenneth Porter <sh************ *@sewingwitch.c omwrote in
news:Xn******** *************** ***@207.46.248. 16:
That suggests that there's a bug in SmtpClient.Send . The error message
is probably from the Postfix mail server and is saying that there's
either a LF or CR by itself on the end of a line. SMTP requires that
lines end with a CR followed by a LF.
Looks like this isn't the only bug:

http://www.themssforum.com/Framework...uthentication/

Get a copy of Wireshark and see what characters are really being exchanged.

http://www.wireshark.org/
Jun 27 '08 #7
You aren't having conflicts between the MailMessage types, are you? I believe
the two types are System.Net.Mail and ...System.Web.M ail? (not sure about the
second)

Here is what my code looks like:
// ---------------------
bool ok = true;
MailAddress toMe = new MailAddress("fa *********@joesw elding.biz");
// txtEmail is a TextBox on the form:
MailAddress from = new MailAddress(txt Email.Text); // from the form
System.Net.Mail .MailMessage Email =
new System.Net.Mail .MailMessage(fr om, toMe);
// Your host will probably be different. This is what I use on GoDaddy
SmtpClient server = new SmtpClient("rel ay-hosting.secures erver.net");
// txtMessage is a TextBox on the form:
string strHtmlBody = "<html><bod y>" + txtMessage.Text + "</body></html>";
Email.Subject = "Joe's Welding - Contact";
Email.Body = strHtmlBody;
Email.IsBodyHtm l = true;
try {
server.Send(Ema il);
} catch (Exception err) {
Response.Write( "<b>Unable to send: " + err.Message + "</b><br/>");
ok = false;
}
// ----------------------

Is this very different from what you are running?

"Marty" wrote:
On Jun 10, 2:44 pm, Marty <marty.wass...@ gmail.comwrote:
On Jun 10, 2:26 pm, jp2msft <jp2m...@discus sions.microsoft .comwrote:
Try specifying an Encoding in your Message. I had problems with SMTP in the
past and it was solved (in part) by setting the Encoding.
"Marty" wrote:
I'm having issues sending an email to an "@page.nextel.c om" email
address. I can send to any other email address fine, but when I try
the page.nextel.com it gives me this error:
Final-Recipient: XXXX...@page.ne xtel.com
Diagnostic-Code: smtp; 554 message body contains illegal bare CR/LF
characters.
Action: failed
Status: 5.0.0
I think it has something to do with the headers that are being sent.
All I have in the subject and body is the word "test." Using this
same SMTP relay, I can get a PHP script to send an email if I strip
out all the headers. Whenever I send via MailMessage/SmtpClient it
fails. I've tried using the MailMessage.hea ders.clear(), but no
success.
Here is my code:
MailMessage mess = new MailMessage(txt From.Text,
txtTo.Text);
mess.Subject = "Test Message";
mess.Body = "Test Message";
mess.Headers.Ad d("From", txtFrom.Text);
mess.Headers.Ad d("To", txtTo.Text);
SmtpClient client = new SmtpClient(smtp Server, 25);
client.Send(mes s);
mess.Dispose();
Thanks
Marty
What encoding should I try? UTF8, Unicode, or UTF3....

I tried all encoding types with no luck. Here is the code I used
before the SmtpClient.Send ().

mess.BodyEncodi ng = System.Text.Enc oding.Unicode;
mess.SubjectEnc oding = System.Text.Enc oding.Unicode;
Jun 27 '08 #8
Please look following articles for the sending email using SMTP.

http://www.a2zdotnet.com/View.aspx?id=38
http://www.a2zdotnet.com/View.aspx?id=50
--
regards,
Pankaj
http://www.A2ZDotNet.com
"Marty" wrote:
I'm having issues sending an email to an "@page.nextel.c om" email
address. I can send to any other email address fine, but when I try
the page.nextel.com it gives me this error:

Final-Recipient: XX*****@page.ne xtel.com
Diagnostic-Code: smtp; 554 message body contains illegal bare CR/LF
characters.
Action: failed
Status: 5.0.0

I think it has something to do with the headers that are being sent.
All I have in the subject and body is the word "test." Using this
same SMTP relay, I can get a PHP script to send an email if I strip
out all the headers. Whenever I send via MailMessage/SmtpClient it
fails. I've tried using the MailMessage.hea ders.clear(), but no
success.

Here is my code:

MailMessage mess = new MailMessage(txt From.Text,
txtTo.Text);
mess.Subject = "Test Message";
mess.Body = "Test Message";
mess.Headers.Ad d("From", txtFrom.Text);
mess.Headers.Ad d("To", txtTo.Text);
SmtpClient client = new SmtpClient(smtp Server, 25);
client.Send(mes s);
mess.Dispose();
Thanks
Marty
Aug 11 '08 #9

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

Similar topics

11
2026
by: JD | last post by:
Is it possible using the smtp class in asp.net to send emails and authenticate to the mail server that is sending the emails out. Currently I have a web application that works fine on my machine, will send email to both my company email addresses and to non-company email addresses. However, as soon as I move the app into the production server it does not send email to non company email addresses. What I mean by company is our domain...
2
1530
by: 00_DotNetWarrior | last post by:
I followed this article to do authenticated SMTP, it works fine with port 25. (using .NET framework 1.1) http://support.microsoft.com/default.aspx?scid=kb;en-us;555287 However, if I change the port number to 10025 (my email server is running on this port too). I got error message "Fields update failed. For further information, examine the Status property of individual field objects." After some testing, I found that if the port...
34
18270
by: antonyliu2002 | last post by:
I've set up the virtual smtp server on my IIS 5.1 like so: 1. Assign IP address to "All Unassigned", and listen to port 25. 2. Access Connection granted to "127.0.0.1". 3. Relay only allow "127.0.0.1". 4. Authentication: "Anonymous access" only. 5. Outbound connection listen to TCP 25. Besides,
1
2956
by: Benny Ng | last post by:
Dear All, Now I just finished my winform application. And a part of that is to send email reminder to the users. It's working fine in the server that with SMTP service in Windows 2003. But now the user wants to used the Linux server to send email messages. (already installed the SMTP service in that). Unfortunatelly one error shown after the sending funciton invoked. It shows "Pickup directory is not existed,x,x,x,,"
1
1318
by: | last post by:
Hi all, I am trying to send an email in some asp.net code and our SMTP Server (EXchange) keeps kicking back with this message:- Mailbox unavailable. The server response was: 5.7.1 Requested action not taken: message refused Any ideas? The ip address of the sending server is in the allow relay list for the smtp server.
2
3622
by: oliu321 | last post by:
Hi, First I am not trying to write a client to talk with hotmail straightly. I am trying to write some codes to send emails through a SMTP server. I wrote a C++ version using pure socket programming and SMTP protocol, a VB version using CDO and a C# version using System.Net.Mail. Now all of them works great with any email account but hotmail. So here is the C# code:
4
7684
by: =?Utf-8?B?dHBhcmtzNjk=?= | last post by:
I have a web page that at the click of a button must send a bunch (1000+) emails. Each email is sent individually. I have the code working fine, using Mail Message classes and smtp and all that. But sometimes even when I'm just sending one e-mail the web page takes a minutes or so to post. Can anyone tell me why it is so slow, or how to fix the problem? To address this I am thinking of just creating a queue table to write the emails...
2
12175
by: =?Utf-8?B?QWRl?= | last post by:
HI All, I am encountering the following error when I try to send an email through a SMTP server. I believe the problem lies with the authentication part when the network crednetials are used, error is thrown at the .send point. Error is: The following error occured Sending an email: System.ApplicationException: An error occurred sending an email To helen@HerMail.com From ade@MyMail.com Cc Subject A test with Finlistener #1. The body...
5
5090
by: =?Utf-8?B?TWlrZQ==?= | last post by:
Hi, I'm using this code for sending emails and its working fine because I had configured SMTP in my machine in IIS. now I'm using machine as a server for this application. but when running the same application from other machine the email process is not working. so, do I have to configure and install SMTP in all client machine to get it working!? or should it be enough just to set it in the server machine?
0
9591
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
10225
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8880
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7415
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
6676
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
5449
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3969
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
3573
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2816
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.