ASP.NET Email From Name (non-email address)

  • Thread starter Thread starter magister
  • Start date Start date
M

magister

Hi I am sending emails from my website. The from field usually is an
email address, but alot of email readers also seem to be able to
pickup a "from real name". I read somewhere that I can set this by
putting the name followed by the actual email address in
parathesis....like this...

MailMessage msgMail = new MailMessage();
msgMail.To = EmailAddress.Text;
msgMail.From = "funny email Website" + "([email protected])";
msgMail.Subject = "Your Document";
msgMail.BodyFormat = MailFormat.Text;
msgMail.Body = " ";
SmtpMail.SmtpServer = "127.0.0.1";
SmtpMail.Send(msgMail);

However this doesn't seem to work for me. I am sending to an email
address in the same domain....I just get from "Website"

Any ideas, I seem to remember that CDONTS had support for a FromName,
why don't we have this in .net????
 
The format is : Display Name <email address>

so msgMail.From = "Some Name <someemail>";

Craig
 
I did try

msgMail.From = "Some Name <someemail>";

&

msgMail.From = "Some Name (someemail)";

no go, would the mx settings in microsoft exchange
override these coded setting??

Thanks,
Matt
 
The Exchange SMTP service can be configured to block outgoing email from
addresses it does not recognize, but I've never encountered this.

The canonical format is 'John Doe <[email protected]>'
 
Back
Top