Skip to content Skip to sidebar Skip to footer

Apply Underlining, Bold, Italics Etc. On Email Body Created In Google Script

Can I know how do I insert bolding, underlining, italics, changing of word fonts for email bodies in Google Script? Here is my example, it is an email, I would like to insert vario

Solution 1:

If using HTMLBody then you can add underline to the email by adding a custom css style to the text to be underlined. e.g.

some random text <span style="text-decoration: underline">underlined text</span> back to normal

text-decoration has the following valid values.

underline
line-through
overline

Solution 2:

You can use htmlBody option when sending an email:

message += "<br>Here is an <spanstyle="text-decoration: underline;font-style: italic; font-weight: bold;"> Underlined,bold and italic</span>text.";


  GmailApp.sendEmail(sendTo, subject, textbody, {htmlBody: message});

htmlBody if set, devices capable of rendering HTML will use it instead of the required body argument (here textbody); you can add an optional inlineImages field in HTML body if you have inlined images for your email.

Refer: https://developers.google.com/apps-script/reference/gmail/gmail-app#sendemailrecipient-subject-body-options

Post a Comment for "Apply Underlining, Bold, Italics Etc. On Email Body Created In Google Script"