Send a basic and formatted e-mail message from a workflow

Send a basic and formatted e-mail message from a workflow

  • Comments 3
  • Likes

 

Send a basic and formatted e-mail message from a workflow

  

In workflow designing, Send E-mail is the arguably the most popular and commonly used action. Now the out of the box formatting used by the designer is something most of us would like to modify so as to improve the look and feel of the mail which is generated by the workflow. However the editor of the e-mail body does not contain any formatting tools, this can be done by the designer……………Read On

Since the Workflow Designer supports only inline styles for formatting messages, and not external or embedded cascading style sheet (CSS) formatting, you must do any formatting that you want by using the style attribute with HTML tags. You can do this either by typing the HTML tags directly into the Define E-mail Message dialog box in the Workflow Designer, or by creating the body of your message in Code view and Design view and then pasting it into the Define E-mail Message dialog box.

 

Design the HTML needed in the body

 

  1. Create a new HTML page from File > New > HTML.
  2. In the new pane, select Split view from the bottom left corner of the screen

 

clip_image001

There are two considerations when you use HTML in workflows :

 

Consideration 1

  • Workflow e-mails do not support class-based styles. All the formatting must be done using inline styles.
  • If you format the message text in Code view and Design view, you must set Style Application to Manual so that SPD 2007 does not add CSS classes, which the server cannot render in workflow mail.
  • For this, click the Style Application icon on the bottom bar.
  • Make sure that Style Application is set to Manual and the Target Rule is set to New Inline Style.
  

clip_image001

 

 

Consideration 2

  • Any white space will affect how the designed HTML will be displayed. So it is recommended to remove it.
  • This can be done easily by performing these steps:
  • Click Tools > Optimize HTML.
  • In the Remove Whitespace section, select HTML all whitespace.

 

clip_image002

 

  • Click OK. 
  • All the whitespace should be removed from the HTML code in the Code Pane.
  • To get the formatted text again, Select the text in the Code Pane > right-click > reformat HTML.

3.  Delete the default text in the Code Pane.

4.  Copy and Paste the following text as an example in the Code Pane.

                 

<table style="border-collapse: collapse; width: 100%" dir="ltr" cellspacing="0">

<tr style="background-color: #f8f8f9; border: thin #e8eaec solid">

<td style="font-family: Verdana; font-size: 16pt; background-color: #f8f8f9; border: thin #e8eaec solid; padding: 20px 20px 20px 20px">

An announcement has been added by

<strong style="color: #008B00; font-variant: small-caps">[*****LOOKUP Created

By*****]</strong></td>

</tr>

<tr>

<td></td>

</tr>

<tr style="background-color: #f8f8f9; border: thin #e8eaec solid">

<td style="font-family: Verdana; font-size: 14pt; background-color: #f8f8f9; border: thin #e8eaec solid; padding: 10px 40px 10px 40px">

Item Details</td>

</tr>

<tr>

<td style="font-family: Calibri; font-size: 12pt; padding: 5px 60px 5px 60px">

<ul style="margin-top: 5px; margin-bottom: 5px">

<li style="margin-top: 1px; margin-bottom: 1px">Title: [*****LOOKUP

TITLE*****]</li>

<li style="margin-top: 1px; margin-bottom: 1px">Expiration Date: [*****LOOKUP

EXPIRATION DATE*****]</li>

</ul>

</td>

</tr>

</table>

5.  Click anywhere in the Design Pane, in order to see how your mail body would look like.

6.  Perform the changes you wish.

7.  Now remove the whitespace as explained in the previous Note section.

  

Formatting

 

Format text as usual by using WYSIWYG tools in Design view

  • If you want to format text inside a tag — for example, <para> or <li> — position the insertion point in Code view, and then double-click the tag you want in the Toolbox.
  • Alternatively, you can type the tag, and then use IntelliSense to insert the style attribute and any property/value pairs that you want. Make sure to separate property/value pairs with a semicolon.

 

A few best practices

  • Use paragraph tags (<p> and </p>) to define separate paragraphs, and to specify any default formatting for a paragraph that is different from the default formatting for the message overall.
  • Within a paragraph, use additional span tags to specify any local formatting that differs from the default formatting of the paragraph and the message overall.
  • The Workflow Designer renders any manual line break as an additional line break in the message. Because the paragraph tags already add appropriate space between paragraphs, you must remove all manual line breaks from the final version of the message in the Designer to avoid having too much space between paragraphs. [Consideration 2]

Not Supported

The following options are not supported by the current version of the Send an Email action

  • Specifying an address on the From line.
  • Including a hyperlink to the Workflow Status page.
  • Using an embedded cascading style sheet (CSS) to format message content. (Text can be formatted by using the style attribute, but the <style> tag and CSS classes are not supported.)
  • Using a workflow lookup in either the To or CC box that references a column of the Person or Group type that contains multiple values.
  • Specifying a Bcc (blind carbon copy) recipient for a message.
  • Including another file with a message as an attachment.
  • Embedding image or graphic files in a message though you can specify a link to an image).

Reference
Send e-mail in a workflow (Office.microsoft.com)

Comments
  • Specifying an address on the From line. (E-mail messages sent by the workflow always show the e-mail address specified by the server administrator on the From line. Only the server administrator can change this, and it can only be changed for all notifications in the current Web application, not per workflow.)

  • Thanks so much for the above info. Not sure anyone else has figured out that you can use what you described above in Sharepoint workflows, i.e. emails for text formatting. CSS does not work and some other styles have been deprecated with newer HTML adoptions.

  • Specifying a Bcc (blind carbon copy) recipient for a message is possible through Advanced properties in the SPD.

Your comment has been posted.   Close
Thank you, your comment requires moderation so it may take a while to appear.   Close
Leave a Comment