特定の販売注文のメモを入力する機能がある Web アプリケーションを開発しました。
顧客または顧客サービス エグゼクティブがメモを入力すると、電子メール通知が関係者に送信されます (電子メール通知は、C# の SmtpClient および MailMessage オブジェクトを使用して送信されます)。
using (MailMessage objEmail = new MailMessage())
{
Guid objGuid = new Guid();
objGuid = Guid.NewGuid();
String MessageID = "<" + objGuid.ToString() + ">";
objEmail.Body = messagebody.ToString();
objEmail.From = new MailAddress(sFrmadd, sFrmname);
objEmail.Headers.Add("Message-Id", MessageID);
objEmail.IsBodyHtml = true;
objEmail.ReplyTo = new MailAddress("replyto@email.com");
objEmail.Subject = sSubject;
objEmail.To.Add(new MailAddress(sToadd));
SmtpClient objSmtp = new SmtpClient();
objSmtp.Credentials = new NetworkCredential("mynetworkcredential", "mypassword");
objSmtp.DeliveryMethod = SmtpDeliveryMethod.Network;
objSmtp.EnableSsl = true;
objSmtp.Host = "myhostname";
objSmtp.Port = 25;
objSmtp.Timeout = 3 * 3600;
objSmtp.Send(objEmail);
}
メッセージヘッダーで送信されるメッセージのGuid
としてa を設定しています。Message-Id
これはすべて正常に機能します。
ここで、当事者がそれぞれの受信トレイから電子メール通知に返信する機能を開発したいと考えています。
そして、同じ Sales -Order (当事者が通知を受け取った) のメモに返信を記録したいと考えています。
通知応答の受信トレイを読み取るために OpenPop.dll を使用しています。
/// <summary>
/// Fetch all messages from a POP3 server
/// </summary>
/// <param name="hostname">Hostname of the server. For example: pop3.live.com</param>
/// <param name="port">Host port to connect to. Normally: 110 for plain POP3, 995 for SSL POP3</param>
/// <param name="useSsl">Whether or not to use SSL to connect to server</param>
/// <param name="username">Username of the user on the server</param>
/// <param name="password">Password of the user on the server</param>
/// <returns>All Messages on the POP3 server</returns>
public static List<Message> FetchAllMessages(string hostname, int port, bool useSsl, string username, string password)
{
// The client disconnects from the server when being disposed
using (Pop3Client client = new Pop3Client())
{
// Connect to the server
client.Connect(hostname, port, useSsl);
// Authenticate ourselves towards the server
client.Authenticate(username, password);
// Get the number of messages in the inbox
int messageCount = client.GetMessageCount();
// We want to download all messages
List<Message> allMessages = new List<Message>(messageCount);
// Messages are numbered in the interval: [1, messageCount]
// Ergo: message numbers are 1-based.
for (int i = 1; i <= messageCount; i++)
{
allMessages.Add(client.GetMessage(i));
}
// Now return the fetched messages
return allMessages;
}
}
上記の関数から、「replyto@email.com」アカウントからすべてのメールを読むことができます。Message-Id
しかし、メールのIn-reply-to
ヘッダーでを見つけることができません。
何が間違っているのかわかりません。