Related Tags:
Asp.Net It was developed by Microsoft to allow programmers to build dynamic web sites, web applications and web services. It was first released in January 2002 with version 1.0 of the .NET Framework, and is the successor to Microsoft's Active Server Pages (ASP) technology. Learn More, ASP.NET MVC The ASP.NET MVC framework is a lightweight, highly testable presentation framework that (as with Web Forms-based applications) is integrated with existing ASP.NET features, such as master pages and membership-based authentication. The MVC framework is defined in the System.Web.Mvc assembly. Learn More, SMTP Simple Mail Transfer Protocol (SMTP) is the standard protocol for email services on a TCP/IP network. SMTP provides the ability to send and receive email messages. SMTP is an application-layer protocol that enables the transmission and delivery of email over the Internet. Learn More,

System.Net.Mail.SmtpException: Transaction failed. The server response was: Rejected - Message containing bare LF's.

Description:I am sending email through my code using c#,and the email functionality working fine on my local environment but when deployed on live environment it started giving me following exception,
System.Net.Mail.SmtpException: Transaction failed. The server response was: Rejected - Message containing bare LF's.

I am sending html formatted email.

Posted by: | Posted on: Oct 12, 2018

1 answers

Replies

5

The appearance of "bare" "CR" or "LF" characters in text (i.e., either without the other) has a long history of causing problems in mail implementations and applications that use the mail system as a tool.
Simple way to solve this is by removing those character from your email html, you can use the following code for the purpose.

emailHtml = emailHtml.Replace("\r", string.Empty).Replace("\n", string.Empty);

Replied by: | Replied on: Oct 17, 2018



Reply
×

Code block Hyperlink bold Quotes block Upload Images

Preview