GmailApp.sendEmail() From Plus Address

拥有回忆 提交于 2019-12-06 16:45:34

You have to use the parameter from: in the methode GmailApp.sendEmail.

Example

GmailApp.sendEmail('example@exapmle.com', 'Testmail', 'Hello Richard',
                        {name: 'Richard Michel', from: 'example+pch@gmail.com',}); 

I'm using Mail Merge HD and i edited the code a little.

In function fnMailmerge() i added the lines

  top_panel.add(myapp.createLabel("Please select your alias"));
  var lf = myapp.createListBox(false).setWidth(250).setName('from').addItem("Select aliases...").setVisibleItemCount(1);

  for (var i = 0; i < aliases.length; i++) {
   lf.addItem(aliases[i]);
  }

  top_panel.add(lf);

, added the last statement to this line (in the same function)

var handler = myapp.createServerClickHandler('startMailMerge').addCallbackElement(lb).addCallbackElement(name_box).addCallbackElement(bcc_box).addCallbackElement(lf);

and finaly editet the function Gmail.sendEmail

 GmailApp.sendEmail(rowData.emailAddress, emailSubject, emailText,
                        {name: e.parameter.name, attachments: attachments, htmlBody: emailText, cc: cc, bcc: bcc, inlineImages: inlineImages, from: e.parameter.from,});

This adds a dropdown list to the Mail Menu, where you can chose from your registered Aliases.

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!