Send email-Display Name and URL quesiton
I have got a script for sending email. It works fine. But, i need to make some enhancements to it.
1. strFrom="a@hotmail.com" -this need to be displayed as "Quality Reporting" instead of
a@hotmail.com in the user's From address.
2. I need to display a URL in the Body. The URL is in the middle of the body .
How to do these. Thanks.
NSG12
January 20th, 2011 3:14pm
Hi NSG12,
Based on your description, it seems you used to the System.Net.Mail in a Script Task to send out a mail.
If so, we can change the display Name using the following code:
MailAddress from = new MailAddress("ben@contoso.com", "Ben Miller");
Also, we can use HTML as a mail body, so we can display a URL in the body.
For more information, please see:
MailMessage.AlternateViews Property:
http://msdn.microsoft.com/en-us/library/system.net.mail.mailmessage.alternateviews.aspx
MailAddress.DisplayName Property:
http://msdn.microsoft.com/en-us/library/system.net.mail.mailaddress.displayname.aspx
If you have any more questions, please feel free to ask.
Thanks,
Jin ChenJin Chen - MSFT
Free Windows Admin Tool Kit Click here and download it now
January 20th, 2011 9:56pm
Thank you.NSG12
January 21st, 2011 12:36pm
Now i am done with the email Address part and that works fine.
I am still finding difficult with the HTML one.
The message body would be like this -
'You have a new Registration waiting on your Inbox.
Please click on the link below to access the new Registration.
<URL goes here-i need to display the URL here>
Thanks for choosing our...'
How do i do all these in HTML in the body of the message.NSG12
Free Windows Admin Tool Kit Click here and download it now
January 21st, 2011 1:34pm
I got this done. Jin Chen , your answer help. Thanks.NSG12
January 21st, 2011 2:38pm