I can be just blind (very possible!), But I can not find any information here / google somewhere that helps me in general :(
First, below, the code that I use to send an email:
MailMessage newMM = new MailMessage(); newMM.To.Add(new MailAddress(userEmail)); newMM.From = new MailAddress(getFrom, getFromName); newMM.IsBodyHtml = true; newMM.Subject = userSubject; newMM.Body = userHTML; if (chkEncoding.Checked) { newMM.BodyEncoding = System.Text.Encoding.UTF8; newMM.SubjectEncoding = System.Text.Encoding.UTF8; } NetworkCredential basicAuthenticationInfo = new NetworkCredential(mUsername, mPassword); SmtpClient smtp = new SmtpClient(mServer); smtp.DeliveryMethod = SmtpDeliveryMethod.Network; smtp.UseDefaultCredentials = false; smtp.Credentials = basicAuthenticationInfo; smtp.Send(newMM);
Which sends a fine, and makes UTF8 a fine when turned on, etc .... however, in the email I receive this (UTF8 or not):
... MIME-Version: 1.0 From: "The name i want" < fromname@fromdomain.com > To: someone@atadomain.com ...
And this is from checking files in the Queue MSSMTP folder, so it seems to me that .NET adds line breaks or MSSMTP does this when it receives an email.
Has anyone come across this before? or have any ideas? :)
The reason this is important is because Declude says that the address does not match and adds the spam weight that I see through the headers:
X-RBL-Warning: FROMNOMATCH: Env sender ( fromname@fromdomain.com ) From: ("The name i want") mismatch. ... X-Declude-Tests: ... FROMNOMATCH [2] ...
So, I think that other spam filters will also have an impact on themselves.
EDIT:
For reference; All emails look great in all email clients, it's just a problem with the processing of headers / spam.
If someone has free time, is it possible to send a message using .NET and check the original headers (unedited and not reviewed by the mail client) and tell me? I will continue shipping now :)
EDIT2:
I created a basic SMTP server in .NET using sockets, basic responses (220, 250, 354, etc.) and used the code to connect to it and send ... and the problem arises, so it is definitely on code /. NET, not MS-SMTP.
I also created a completely new application for Windows.NET 4.0, added a button and placed it in this code (note, I added the use of System.Net.Mail; at the top too, but nothing else from a clean new Windows application):
private void button1_Click(object sender, EventArgs e) { MailMessage newMM = new MailMessage(); newMM.To.Add(new MailAddress(" toaddress@domain.com ")); newMM.From = new MailAddress(" fromaddress@domain.com ", "Happy As'Larry"); newMM.IsBodyHtml = true; newMM.Subject = "My Subject"; newMM.Body = "My HTML"; SmtpClient smtp = new SmtpClient("localhost"); smtp.DeliveryMethod = SmtpDeliveryMethod.Network; smtp.Send(newMM); }
Please note that this is NOT edited in any way ... there is no need for verification as its local SMTP test output application, so it is exactly like it above.
My SMTP application uses the TcpListener and Socket objects from System.Net.Sockets and just prints all the deleted data in a simple text field, it parses the line for the command buffer so that it can actually respond and get the DATA command to verify that it sends .NET :)
The conclusion is here:
EHLO WhiteDragon-PC MAIL FROM:< fromaddress@domain.com > RCPT TO:< toaddress@domain.com > DATA MIME-Version: 1.0 From: "Happy As'Larry" < fromaddress@domain.com > To: toaddress@domain.com Date: 28 Feb 2011 19:00:19 +1100 Subject: My Subject Content-Type: text/html; charset=us-ascii Content-Transfer-Encoding: quoted-printable My HTML .
So, with 2 completely new applications, with very basic code in each of them, there is still a problem!
Is this a .NET 4.0 bug? if someone wants SMTP code, I will insert this too if you want to check this thing.