Change Email Display Name :-
In this post i going to show how to overwrite the E-mail sender’s display name in C#.NET. We can follow the same thing in VB.NET too. Email display name, it is shows information about email to receiver, Email Subject when it came who sent this mail. That place we can overwrite exist name with our special name. For example I sent mail from ID “myemail@mydomain.com” to email ID “youremail@mydomain.com”. So, once we opened the mail we can see sent from myemail or else mail configured name, I am not sure with this.
But we can overwrite that to you name “Email Sender’s Name”. but mail id will be same. It is very easy. Please follow below code, it is in C#.net.
Code:-
using System.Net.Mail; // We must import System.Net.Mail, don’t forget about this.
public string SendMailWithSenderName()
{
try
{
using(MailMessage message = new MailMessage(
new MailAddress(“myemail@domain.com”, “***Overwrite sender’s Name***”), //Sender email details
new MailAddress(“youremail@domain.com”) //Receiver email, here no need to add display name.
)) {
message.Subject = “Mail Subject”;
message.Body = “Wow!, sender display name is changed..!”;
new SmtpClient().Send(message);
}
return “Done!”
}
catch
{
return “Error!”;
}
}
After sending mail, If we check that it will be like this
Sender name — ***Overwrite sender’s Name***
Subject — Mail Subject
Body — Wow!, sender display name is changed..!
I hope it is useful for your, if you have better idea then this please put it in comment, let me know thanks. Please ignore if I done any mistakes in this post.
Enjoy while coding..!
Thanks,
Naga Harish Movva.
We have recent migration from exchange server 2007 to 2010 it is stop working .. Any comments.
Thanks for helping..!.
Thanks & Regards,
Siva
Sorry!, no ideas about exchange server 2007 or 2010
Great Helps, It’s Working now
but recipient reply to that mail it will display original name only.can you tell how to display Overwrite sender’s Name there also