Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/google-apps-script/6.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Google apps script 如何在通过谷歌应用程序脚本发送时更改链接颜色_Google Apps Script - Fatal编程技术网

Google apps script 如何在通过谷歌应用程序脚本发送时更改链接颜色

Google apps script 如何在通过谷歌应用程序脚本发送时更改链接颜色,google-apps-script,Google Apps Script,我在谷歌应用程序脚本中使用GmailApp发送电子邮件 sendmail(“,EMAIL_TITLE,”,{'cc':cc,htmlBody:newMsg}) htmlBody是在code.gs中编写的,它是一个简单的代码。它仅显示链接列表: str+=“”+strTitle+“\n” 因为我想强调一些更重要的环节。我尝试使用if语句更改样式(例如链接颜色或背景颜色) 但是,以下各项都不起作用。它说代码有一个缺失的语句错误。如果从链接的html中删除style=“…”,则代码将起作用 1.)st

我在谷歌应用程序脚本中使用GmailApp发送电子邮件

sendmail(“,EMAIL_TITLE,”,{'cc':cc,htmlBody:newMsg})

htmlBody是在code.gs中编写的,它是一个简单的代码。它仅显示链接列表:

str+=“

  • ”+strTitle+“
  • \n”

    因为我想强调一些更重要的环节。我尝试使用if语句更改样式(例如链接颜色或背景颜色)

    但是,以下各项都不起作用。它说代码有一个缺失的语句错误。如果从链接的html中删除style=“…”,则代码将起作用

    1.)str=“

  • “+strTitle+”
  • \n”

    2.)str=“

  • “+strTitle+”
  • \n”

    为什么??是否有其他方法可以更改链接的样式?

    请尝试以下方法:

    function testmailHTML(){
      var strTitle = 'go to this test'
      var newMsg = "<a href='www.google.com' style=color:red /a>" + strTitle ;
      GmailApp.sendEmail("xxxxx@gmail.com",'EMAIL_TITLE', "", {htmlBody: newMsg });
    }
    
    函数testmailHTML(){ var strTitle='进行此测试' var newMsg=“”+strttle; GmailApp.sendmail(“xxxxx@gmail.com“,'EMAIL_TITLE',”,{htmlBody:newMsg}); } 结果如下:


    非常感谢。它起作用了!我有红色的链接<仅供参考。我还尝试了var newMsg=“”+strTitle;它将在gmail中提供黑色链接。