Ask a Question
Advertise on boostr.in
Organizational Research By
Surprising Reserch Topic
css on email using -'asp.net,css,email,smtp'
css on email ¬†using -'asp.net,css,email,smtp'
Has anyone found a good way of embeding CSS in a programatically produced email. The best way I have found is to put the style code into a resource file and call it into the code.
An emample would be
objBuilder = New StringBuilder
objBuilder.Append("My Styled Email")
Dim _Body As String = objBuilder.ToString()
This would build the body of the email
Is there any way to make a template file for an email or a better way to call a style sheet into one.
The code in my .resx file would be
¬†¬†¬†¬†font-family: Tahoma, Verdana, Arial;
¬†¬†¬†¬†padding: 3px 0px 0px 0px;
¬†¬†¬†¬†margin: 0px 0px 0px 0px;
And calling this into the string would call this inline
And with the answers below to send the message I would use this
Dim client As New SmtpClient("localhost")
Dim toAddr As New MailAddress(MailRecipients)
Dim fromAddr As New MailAddress(MailFrom)
Dim message As New MailMessage(fromAddress, toAddress)
message.Subject = "The Subject"
message.Body = ¬†_Body
message.IsBodyHtml = True
message.BodyEncoding = System.Text.Encoding.UTF8
Sep 7, 2015
to add a comment.
Related Hot Questions
Your name to display (optional):
Email me at this address if my answer is selected or commented on:
Email me if my answer is selected or commented on
Privacy: Your email address will only be used for sending these notifications.
To avoid this verification in future, please