SMTP Mail

  • Thread starter Thread starter Peter
  • Start date Start date
P

Peter

I am trying to send SMTP mail:

I have the following code which works fine on one domain, but not on other. It does not work until I remove the Message-ID: line, than it works just fine.

Here's how I removed the Message-ID line:
I stopped the SMTP service (so I could edit the mail file in the Pickup directory), ran the program to send the email, than I edited the file in the Pickup directory and removed the Message-ID line from the message, than restarted the SMTP service. If I leave the line in the file to message disappears from Pickup directory but never arrives at it's destination.

My question: Is there a way I can prevent the program from writing the Message-ID: line? or is there some other setting that I am not aware.



//-------------------- The code ---------------------------------------------------------
MailMessage aMessage = new MailMessage();

aMessage.From = "(e-mail address removed)";

aMessage.To = "(e-mail address removed)";
aMessage.Cc = "";
aMessage.Bcc = "";
aMessage.Subject = "Test";
aMessage.Body = "body";
aMessage.Attachments.Add(new MailAttachment(@"c:\1.txt", MailEncoding.Base64));
SmtpMail.SmtpServer = "";
SmtpMail.Send(aMessage);
//---------------------------------------------------------------------------------


// ---- Here is part of the message ----------------------------------------------

X-Receiver: (e-mail address removed)
X-Sender: (e-mail address removed)
From: <[email protected]>
To: <[email protected]>
Subject: Test
Date: Tue, 14 Oct 2003 15:40:21 -0500
Message-ID: <[email protected]>
MIME-Version: 1.0
Content-Type: multipart/mixed;
boundary="----=_NextPart_000_0001_01C39269.7A17B020"
X-Mailer: Microsoft CDO for Windows 2000
Thread-Index: AcOSk2LFkb/R5J89RPO03O858K66QA==
Content-Class: urn:content-classes:message
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165

This is a multi-part message in MIME format.
 
Peter said:
I am trying to send SMTP mail:

I have the following code which works fine on one domain, but not on
other. It does not work until I remove the Message-ID: line, than it
works just fine.
Peter -

When you say "works fine on one domain, but not on other", do you
mean that you can send messages to one domain, but not to another? If
so, I think the problem could be that the one domain is rejecting your
messages based on a Message-ID header field check.

Although not a "standard" header field, some e-mail servers now
check the Message-ID: header field if it is present to ensure that the
domain part of the ID matches a valid domain. It's possible that the
remote mail server is rejecting your messages because you do not have
a valid domain configured on your SMTP server, or because the domain
in the Message-ID field does not match the domain in the From: field
in the message.

I would recommend loading the free WinPcap drivers and using the
Analyzer program (http://analyzer.polito.it) to watch the SMTP session
from your machine. You should be able to see if the remote e-mail
server rejects your message, and why it is rejected. Hope this helps
point you in the right direction.

Rich Blum - Author
"C# Network Programming" (Sybex)
http://www.sybex.com/sybexbooks.nsf/Booklist/4176
"Network Performance Open Source Toolkit" (Wiley)
http://www.wiley.com/WileyCDA/WileyTitle/productCd-0471433012.html
 
Thanks for the WinPcap tip!
The problem disapeard after I rebooted the computer - so I don't know what
was the problem and I can't duplicate it now.
 
Back
Top