【问题标题】:bold & italic message in GmailAppGmailApp 中的粗体和斜体消息
【发布时间】:2021-04-12 09:15:01
【问题描述】:

https://www.youtube.com/watch?v=r9uU_KwGgzQ&t=1154s

我有使用 YouTube 链接的程序,该链接使用谷歌表单到谷歌表格,然后使用模板生成 PDF。

但在 GMailApp 脚本中,我无法加粗和下划线。

这是消息

var message =  
`\nThank you. You have successfully completed your form. 
\nPlease print the attached PDF copy of the form and submit the signed hardcopy by Friday, 16th April 2021. 
\nNote: This is an automated system generated email. Please do not reply this email.`

如何加粗“2021 年 4 月 16 日星期五”和 斜体“注意:这是系统自动生成的电子邮件。请不要回复此电子邮件。

【问题讨论】:

标签: google-apps-script gmail-api


【解决方案1】:
Use html to build the message variable then pass it to the Gmail app...

var message = '<br>Thank you. You have successfully completed your form.<br>'
   message += 'Please print the attached PDF copy of the form and submit the signed hardcopy by '
   message += '<b><i>Friday, 16th April 2021.</i></b>'
   message += '<br>Note: This is an automated system generated email. Please do not reply this email.'

GmailApp.sendEmail('to@email.address', 'subject', 'message preview',{
      from: from@email.address,
      htmlBody: message
    });

【讨论】:

    【解决方案2】:

    使用 HTML 格式化正文并使用 htmlBody 选项发送。

    【讨论】:

      猜你喜欢
      • 2011-07-18
      • 2021-02-19
      • 2016-01-02
      • 1970-01-01
      • 1970-01-01
      • 2012-12-10
      • 1970-01-01
      • 2013-01-07
      • 1970-01-01
      相关资源
      最近更新 更多