how to format text for email message

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hello,

I need to send an automated email message from my application (vb2005) -
using system.net.mail. What I need to do to the message is to format the
text, like underlining, bolding, changing font colors. I can send the
message OK with the default font senttings. But how can I customize the
fonts/Text?

Thanks,
Rich
 
So I am sending the mail via smtp using system.net.mail. It seems that there
is a property for the message body >> Message.IsBodyHtml

If I state

Message.IsBodyHtml = True

then I can use HTML tags in the text and format the text that way. I just
tried it and it works:

Message = "<font size=2 color=red> testing </font>"

Any other suggestions greatly appreciated.
 
Depending on who you are sending to. I would also recommend you look at the
AlternateView class.

http://msdn2.microsoft.com/en-us/library/system.net.mail.alternateview.aspx

Leave the MessageBody as plain text, then add an AlternateView that is HTML.

This way recipients that don't have "rich text" enabled (read HTML enabled)
in their email client will see the plain text version, while the rich
text/html enabled email clients will see the formatted version...


--
Hope this helps
Jay B. Harlow [MVP - Outlook]
..NET Application Architect, Enthusiast, & Evangelist
T.S. Bradley - http://www.tsbradley.net


| So I am sending the mail via smtp using system.net.mail. It seems that
there
| is a property for the message body >> Message.IsBodyHtml
|
| If I state
|
| Message.IsBodyHtml = True
|
| then I can use HTML tags in the text and format the text that way. I just
| tried it and it works:
|
| Message = "<font size=2 color=red> testing </font>"
|
| Any other suggestions greatly appreciated.
|
|
| "Rich" wrote:
|
| > Hello,
| >
| > I need to send an automated email message from my application (vb2005) -
| > using system.net.mail. What I need to do to the message is to format
the
| > text, like underlining, bolding, changing font colors. I can send the
| > message OK with the default font senttings. But how can I customize the
| > fonts/Text?
| >
| > Thanks,
| > Rich
 
Back
Top