Click here to Skip to main content
15,884,809 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Can i get message-id of send email so i correlate mail with the later incoming mail..

While sending the mail from client, I am setting the "message-id" in the header.
but message id set by me in the header is reset (or replaced) by the mail server.

Is there any setting in mail server to reset auto-generate of message-id to false in email header. so it is not replaced by mail server
Posted
Updated 7-Aug-14 0:39am
v2
Comments
Manoj B. Kalla 14-Aug-14 5:19am    
Can you show your detail code ?

Are you using SMTP or Normal emailing codes.

Manoj Kalla
deshmukh sachin 28-Aug-14 2:12am    
I Am using SMTP to send an email.

My Detail code like this...

public bool sendmail(string From, string To, string CC, string Subject, string Body )
{
try
{
System.Net.Mail.MailMessage objEmail = new System.Net.Mail.MailMessage();
objEmail.Body = Body;
objEmail.From = new MailAddress(From);
objEmail.IsBodyHtml = true;
objEmail.ReplyTo = new MailAddress(To);
objEmail.Subject = Subject;
objEmail.To.Add(new MailAddress(To));

SmtpClient objSmtp = new SmtpClient();

objSmtp.DeliveryMethod = SmtpDeliveryMethod.Network;
objSmtp.EnableSsl = true;

Guid objGuid = new Guid();
objGuid = Guid.NewGuid();
String MessageID = "<" + objGuid.ToString() + ">";
objEmail.Headers.Add("Message-ID", MessageID); //Set Message-ID in Email Header

System.Net.NetworkCredential credentials =new System.Net.NetworkCredential("UserName", "Password");

objSmtp.Credentials = credentials;
objSmtp.EnableSsl = true;
objSmtp.Host = "smtp.gmail.com";
objSmtp.Port = 587;
objSmtp.Send(objEmail);


Page.ClientScript.RegisterStartupScript(this.GetType(), "script", "javascript:alert('Email Sent Successfully');", true);
return true;
}
catch (Exception ex)
{
throw ex;
}
}

In the above code i had set message-id in email header to GUID.But message-id set by me is replaced by email server...

plz help me...

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900