SPUtility.SendEmail adds spaces and new lines to email body

Problem:

When using SPUtility.SendEmail  to send emails, sometimes it adds spaces and new lines to the email body automatically, or sometimes it even removes some characters, or change < to <.

Solution:

Add “\n” at the end of each paragraph or at the end of each row of your HTML table.

For example:

string emailBody = "<div>Hello,<br /><br />Just letting you know that the CityLink invoice/travel details have been reviewed by all the e-Tag holders.<br /><br />\n";
emailBody += "This is the library and you can view the workflow details here:<br /><br />\n";
emailBody += "<table><tr><th>Name</th><th>ID</th><th>Details</th><th>Date</th></tr>\n";

Advertisements
This entry was posted in SharePoint 2010, Visual Studio 2010. Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s