System.Web.Mail.SmtpMail problem
- From: joseph2000 <joseph2000@xxxxxxxxxxxxxxxx>
- Date: Mon, 14 May 2007 09:38:36 +0000 (UTC)
Hi,
I have problem with e-mails which are being send via System.Web.Mail.SmtpMail class but before describing the problem itself first I'd like to show shortly what I'm doing on the server.
The following code is being executed on the server to send e-mails to clients (.NET Framework 1.1):
....
EmailsInQueCollection eqc = GetUnsentEmails();
foreach( EmailInQue email in eqc ) {
System.Web.Mail.MailMessage msg = new System.Web.Mail.MailMessage();
msg.BodyFormat = System.Web.Mail.MailFormat.Html;
msg.To = email.EmailTo
msg.Bcc = email.EmailBcc;
msg.Cc = email.EmailCC; msg.From = email.EmailFrom;
msg.Subject = email.EmailSubject;
msg.Body = email.EmailBody;
try {
System.Web.Mail.SmtpMail.Send(msg);
} catch {
//logging error info here
....
}
}
....
Everything worked fine when on the server Windows 2000 Server has been installed. Unfortunately due to some reasons we needed Windows 2003 Server and after reinstallation a weird problem appeared. E-mails are still being send without problems (users receive them) but the content of an email is being modified: after every 992 characters the exclamation character (!) is being added to the body and then email which the users receive contain not expected characters. The example of the source e-mail users receive is as follows (sorry for the long example):
<HTML><HEAD><TITLE>Title goes here</TITLE></HEAD><BODY><TABLE WIDTH=100% border=0><TR><TD><H1 color=#0350bc>Header goes here</H1><BR><H2>Request To Do Something</H2></TD></TR></TABLE><TABLE WIDTH=100% border=0><TR><TD>Dear <b>User</b>,<p>Info data - <b>Details</b>. Please do something blabla</p><p><TABLE border=1 cellspacing=0 cellpadding=0 bordercolor=#0350bc width=100%><TR><TD><b> comments:</b></TD></TR><TR><TD><p>test wwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwww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wwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwww!
</p></TD></TR></TABLE><p>Please click this <a href="http://URL to web app">link</a> to access the page where you can see information blablabla... and enter your comments.</p><p>If you are using Internet Explorer as your web browser, you can view the feedback for this blablabla... <a href="http://URL to webbpage">here</a>.</p><p>Thank you!</p><p>Note: Please do not forward this e-mail to others; they will not be able to access the!
data.</p></TD></TR></TABLE></BODY></HTML>
This email contains three exclamation characters injected into the body. Of course such characters don't exist in the original information!
I have found that the characters are injected only if the e-mail format is set to HTML.
I was curious if the final result is the same on .NET Framework 2.0 so I have rewritten the code which is responsible for sending emails (using System.Net.Mail.MailMessage and SmtpClient classes) but the result is the same: exclamation marks are injected into the e-mail body.
Can you help me solving the problem, please? First of all I've no idea why the problem appears on Windows 2003 Server system but does not exists on Windows 2000 Server. The second thing is how to solve the problem: maybe I need to change the server code somehow, maybe I need to install a patch ...
Please help...
Best regards,
Wojtek
.
- Follow-Ups:
- RE: System.Web.Mail.SmtpMail problem
- From: Walter Wang [MSFT]
- RE: System.Web.Mail.SmtpMail problem
- Prev by Date: Re: Does that RegExp makes sense to you, people?
- Next by Date: Re: PropertyType and type...
- Previous by thread: PropertyType and type...
- Next by thread: RE: System.Web.Mail.SmtpMail problem
- Index(es):
Relevant Pages
|