我的代码现在看起来如下:
GmailApp.sendEmail(address, subject, body, {htmlBody : body});我的参考问题: 在使用应用程序脚本创建的电子邮件中添加签名的语法错误
我的问题:它显示发件人为alex.ken@..。
我想要的东西:,我希望脚本以用户的名字命名。所有用户都在Google设置中为他们的电子邮件地址设置了不同的名称。
PS -请注意,我有多个用户使用工作表/宏,所以我不能在name参数中有fix值。
请帮帮忙。
编辑1=Solution:
var user = Session.getActiveUser().getUsername(); //gives username
var firstpart = user.split('.')[0]; //gives first part of username
var uppercase = firstpart.charAt(0).toUpperCase() + firstpart.substring(1); //makes first letter upper case
var display = uppercase + " with Ban Company";
.
.
.
.
GmailApp.sendEmail(address, subject, body, {htmlBody : body + signature,cc: "test@gmail.com",name:display});发布于 2022-03-10 18:06:41
使用
const name = 'Alex from Ban' // replace the string by someway to assign the value that you want to use.
GmailApp.sendEmail(address, subject, body, {htmlBody : body, name: name });参考文献
https://stackoverflow.com/questions/71428113
复制相似问题