How will send a MAIL TRAIL in Asp.Net using C#

Posted by Vishalneeraj-24503 under ASP.NET on 1/25/2021 | Points: 10 | Views : 1762 | Status : [Member] [MVP] | Replies : 2
I have a requirement like I want to have MAIL TRAIL functionality in the dot net. I have written a windows service which will trigger a mail to particular recipient.

If recipient does not respond to that mail then service again sends a reminder mail like follow-up mail.

So whenever mail will be sent again to a recipient it should be treated as a MAIL TRAIL. Like previous mail should also be tracked like at what date previous mail sent).

Note - Just we do reply/reply-all in Gmail/Outlook, then previous mail will also be copied along with current mail.

I am using ASP.NET and C# with in-built System.Net SMTP feature to send mail.

Please suggest any solution.

Thanks in advance.




Responses

Posted by: Ishan7 on: 1/26/2021 [Member] Starter | Points: 25

Up
0
Down
// in the beginning of the file
using System.Net;
using System.Net.Mail;



MailAddress to = new MailAddress("elizabeth@westminster.co.uk");
MailAddress from = new MailAddress("piotr@mailtrap.io");

MailMessage message = new MailMessage(from, to);
message.Subject = "Good morning, Elizabeth";
message.Body = "Elizabeth, Long time no talk. Would you be up for lunch in Soho on Monday? I'm paying.;";

SmtpClient client = new SmtpClient("smtp.server.address", 2525)
{
Credentials = new NetworkCredential("smtp_username", "smtp_password"),
EnableSsl = true
};
// code in brackets above needed if authentication required

try
{
client.Send(message);
}
catch (SmtpException ex)
{
Console.WriteLine(ex.ToString());
}


Vishalneeraj-24503, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Vishalneeraj-24503 on: 2/3/2021 [Member] [MVP] Platinum | Points: 25

Up
0
Down
I am not asking about how to send Email.

I am asking about how to send mail trail programmatically OR

how to track an email thread programmatically in ASP.NET with C#.


Vishalneeraj-24503, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response