मैंने एक वेब एप्लिकेशन विकसित किया है, जिसमें एक विशेष बिक्री-आदेश के लिए नोट दर्ज करने की कार्यक्षमता है।मैं कैसे जान सकता हूं कि कौन सा ईमेल किसी अन्य ईमेल का उत्तर है, सी # में?
जब कोई ग्राहक या ग्राहक सेवा कार्यकारी द्वारा कोई नोट दर्ज किया जाता है, तो संबंधित पार्टी को एक ईमेल अधिसूचना भेजी जाती है (ईमेल अधिसूचना SMTpClient & CM में मेलमेसेज ऑब्जेक्ट्स का उपयोग करके भेजी जाती है)।
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("[email protected]");
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
संदेश की Message-Id
के रूप में स्थापित करने हूँ संदेश हेडर में भेजा जा रहा है।
यह सब ठीक काम करता है।
अब मैं पार्टियों के लिए उनके संबंधित इनबॉक्स से ईमेल अधिसूचना का उत्तर देने के लिए एक कार्यक्षमता विकसित करना चाहता हूं।
और मैं उसी बिक्री-ऑर्डर के लिए नोट्स में जवाब लॉग करना चाहता हूं (जिसके लिए पार्टी को अधिसूचना मिली)।
मैं अधिसूचना-उत्तरों के लिए इनबॉक्स पढ़ने के लिए 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;
}
}
उपरोक्त फ़ंक्शन से मैं अपने "[email protected]" खाते से सभी ईमेल पढ़ने में सक्षम हूं। लेकिन मैं In-reply-to
ईमेल के शीर्षलेख में Message-Id
नहीं ढूंढ पा रहा हूं।
मुझे नहीं पता कि मैं क्या गलत कर रहा हूं।
जहां तक मुझे पता है कि ऐसा करने का कोई विश्वसनीय तरीका नहीं है, तो आप एक ईमेल क्लाइंट की दया पर हैं, और प्रत्येक ईमेल क्लाइंट के अपने स्वयं के quirks है। मैंने देखा है कि इसी तरह की अधिकांश प्रणालियों में * एक अद्वितीय आईडी डालने के लिए विषय पंक्ति * का उपयोग किया जाता है, और फिर, जब संदेश को शुरुआत से "आरई:" स्ट्रिप करने का उत्तर दिया जाता है। –
हम ईमेल में कुछ कस्टम शीर्षलेख जोड़ते थे। – PraveenVenu
मेरा मानना है कि यहां तक कि आउटलुक की बातचीत विषय-आधारित हैं। –