D
David Connors
Hello,
I can't see another appropriate group to post this in. system.web.mail has a
bad bug in it where it is not conforming to RCF822. The old pre-dotnet
CDONTS obects did not have this behaviour.
The problem is that system.web.mail sends messages with naked line feeds in
them rather than escaping them to be a cr and an lf. An lf on a line by
itself is invalid in an SMTP message.
Repro code is attached below. This message will never be able to be
delivered to a qmail server (of which there are many).
The code is:
using System;
using System.Text;
using System.Web;
using System.Web.Mail;
namespace theEmailTest
{
/// <summary>
/// Summary description for Class1.
/// </summary>
class Class1
{
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main(string[] args)
{
MailMessage mm = new MailMessage();
mm.BodyEncoding = Encoding.UTF8;
mm.To = "(e-mail address removed)";
mm.From = "(e-mail address removed)";
mm.Subject = "Test Subject";
mm.BodyFormat = MailFormat.Html;
mm.Body = "Test Body\n\nEnd";
SmtpMail.Send(mm);
}
}
}
The following VBS code does cause the LF characters to be correctly escaped
to a CR + LF pair prior to submitting the message to the local mail queue
for delivery.
Option Explicit
Dim objCDONTS
Set objCDONTS = CreateObject("CDONTS.NewMail")
objCDONTS.To = "(e-mail address removed)"
objCDONTS.From = "(e-mail address removed)"
objCDONTS.Subject = "Test Subject"
objCDONTS.Body = "Test Body" & chr(10) & chr(10) & "End3"
objCDONTS.Send
Set objCDONTS = Nothing
MsgBox "Done."
Any pointers on getting this fixed?
David.
I can't see another appropriate group to post this in. system.web.mail has a
bad bug in it where it is not conforming to RCF822. The old pre-dotnet
CDONTS obects did not have this behaviour.
The problem is that system.web.mail sends messages with naked line feeds in
them rather than escaping them to be a cr and an lf. An lf on a line by
itself is invalid in an SMTP message.
Repro code is attached below. This message will never be able to be
delivered to a qmail server (of which there are many).
The code is:
using System;
using System.Text;
using System.Web;
using System.Web.Mail;
namespace theEmailTest
{
/// <summary>
/// Summary description for Class1.
/// </summary>
class Class1
{
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main(string[] args)
{
MailMessage mm = new MailMessage();
mm.BodyEncoding = Encoding.UTF8;
mm.To = "(e-mail address removed)";
mm.From = "(e-mail address removed)";
mm.Subject = "Test Subject";
mm.BodyFormat = MailFormat.Html;
mm.Body = "Test Body\n\nEnd";
SmtpMail.Send(mm);
}
}
}
The following VBS code does cause the LF characters to be correctly escaped
to a CR + LF pair prior to submitting the message to the local mail queue
for delivery.
Option Explicit
Dim objCDONTS
Set objCDONTS = CreateObject("CDONTS.NewMail")
objCDONTS.To = "(e-mail address removed)"
objCDONTS.From = "(e-mail address removed)"
objCDONTS.Subject = "Test Subject"
objCDONTS.Body = "Test Body" & chr(10) & chr(10) & "End3"
objCDONTS.Send
Set objCDONTS = Nothing
MsgBox "Done."
Any pointers on getting this fixed?
David.