Saturday, March 24, 2012

HTML Email message background color

An HTML email message contains top/bottom logos, a couple of pictures, and some text in between. The whole message body is basically all white. How can the background color of the surrounding area of that email message be set to gray or whatever color in the recipient's view? Thanks.

for html, the background color is set in the corresponding tag. That is:

<body bgcolor="#fff">
text
</body>

the #fff can be changed out, obviously, to any color that html will recognize (i.e. 6 digit hex web colors)


Oh, and it doesn't have to be in the <body> tag necessarily, either. (e.g., could be the <head> tag)
You can write html code in mail.body:
//create the mail message MailMessage mail =new MailMessage();//set the addresses mail.From =new MailAddress("me@.mycompany.com"); mail.To.Add("you@.yourcompany.com");//set the content mail.Subject ="This is an email"; mail.Body ="<body bgcolor="#fff">text</body>"; mail.IsBodyHtml =true;//send the message SmtpClient smtp =new SmtpClient("127.0.0.1"); smtp.Send(mail);

No comments:

Post a Comment