How do i change the from address to a friendly name?

xiaoxiao2021-03-06  42

By Default, Many People Set The from Property of the MailMessage Class To Something Like:

Mail.from = "me@mycompny.com"

By doing this the email address will show up in the FROM line of most email readers, such as Outlook, Outlook Express, or Eudora. To have a friendly name be displayed (instead of the email address), use the following syntax.

Mail.from = "/" john smith / ""

The Following Code Snippet Demonstrates this Technique.

[C #]

MailMessage Mail = New MailMessage ();

Mail.to = "me@mycompany.com";

Mail.From = "/" john smith / "

Mail.subject = "this is a test email."

Mail.body = "this is my test email body."

SMTPMAIL.SMTPSERVER = "localhost"; // Your Real Server Goes Here

SMTPMAIL.SEND (MAIL);

[Vb.net]

DIM Mail as new mailmessage ()

Mail.to = "me@mycompany.com"

Mail.from = "" John Smith ""

Mail.subject = "this is a test email."

Mail.Body = "this is my test email body."

SMTPMAIL.SMTPSERVER = "localhost" 'Your Real Server Goes Here

SMTPMAIL.SEND (MAIL)

转载请注明原文地址:https://www.9cbs.com/read-47647.html

New Post(0)