• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 2908
  • Last Modified:

MailMessage default font and size

Is there a way to control the body font and font size used in MailMessage with plain text?
I don't need to do any fancy HTML formatting (I do make columns as the output) .
I just want to set the entire body to a specific font and size?

Is this possible, how can it be done?
0
alkabello
Asked:
alkabello
1 Solution
 
ukerandiCommented:
you can use like that
 Dim objMM As New MailMessage
        Dim smtpClient As New SmtpClient("localhost")

objMM.Body = "<span style=""font-family:Arial;font-size: 10pt;"">txtmsg.Text &"</span>"
0
 
alkabelloAuthor Commented:
I believe this is a HTML tag.

I'm trying to use Plain Text...

Also, I'm using Visual Studio'd C#, and the above code generates errors.
0
 
TommySzalapskiCommented:
If it is plain text, then no formatting information is sent, just the plain text (as the name suggests). There is no possible way to control how plain text is formatted to the person you send it to.
0
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

 
TommySzalapskiCommented:
If you want to format it, use the HTMLBody field, not the body field.

MailMessage msg = new MailMessage;
msg.HTMLBody = "<font ...etc>text</font>"

Something like that.
0
 
NavneetSoftware EngineerCommented:
HI!

This is done only with HTML Type like :
<font color="red">Some text!</font>

Or
Or you could use CSS:
<h3 style="color: #FF0000;">Some text!</h3>


If you are sending plain text email, there's no way to format your body.

For Sending Email
Use Link
http://www.dijksterhuis.org/using-csharp-to-send-an-e-mail-through-smtp/


Thanks!
0
 
DesignbyonyxCommented:
Worth noting that people intentionally receive plain text emails because they do not wish to see formatted emails. They just want to read text and move on.  Formatted messages may be perceived as sort of "spammish".

Also worth noting plain text emails cannot be formatted by using tabs, spaces, etc. as an attempt to line things up  (such as "columns" as you suggested in your comment):

all email clients use different fonts and font-sizes

users configure system-level and application-level fonts differently

every font face has a different letter width, letter spacing, line height, etc.


0
 
TommySzalapskiCommented:
The correct answer of "No, it cannot be done" was first given here http:#a37318248
0
 
DesignbyonyxCommented:
I agree with @TommySzalapski
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now