亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

通過 GmailApp 以 HTML 格式發送電子郵件以保留簽名和圖像

通過 GmailApp 以 HTML 格式發送電子郵件以保留簽名和圖像

忽然笑 2023-03-10 15:03:44
我有一個項目,我需要批量發送一封電子郵件,其中包含特定于每個用戶的文本,以及來自相關 gmail 帳戶的簽名和圖像。我有這個自動取款機://get template/draft email & bodyconst scGmailTemplate = GmailApp.getDraft("r4329894329375089160");const scGmailTemplateMessage = scGmailTemplate.getMessage();const scGmailTemplateBody = scGmailTemplateMessage.getBody();//create new gmaillet scGmailContactMessageBody = scGmailTemplateBody;//create array for gmail find & replaces [find, replace]const gmailFindReplace = [["INV_START", scVars.INV_START],                          ["INV_END", scVars.INV_END],                          ["DEM_DATE", scVars.DEM_DATE]                         ];gmailFindReplace.forEach(x=>{scGmailContactMessageBody=scGmailContactMessageBody.replace(x[0], x[1])});const scGmailSubject = "Service Charge Invoice ("+scVars.INV_START+"-"+scVars.INV_END+")";let bodyHtml = HtmlService.createHtmlOutput(scGmailContactMessageBody);//didnt workGmailApp.sendEmail("[email protected]", "test", scGmailContactMessageBody);問題是生成的電子郵件只是原始 html,圖像顯示在底部我試過添加{htmlBody: html}作為選項,但會引發錯誤html not defined。任何幫助將非常感激
查看完整描述

2 回答

?
繁星點點滴滴

TA貢獻1803條經驗 獲得超3個贊

需要htmlBody一個字符串。

GmailApp.sendEmail("[email protected]", "test", scGmailContactMessageBody, {htmlBody: scGmailContactMessageBody});

不需要因為let bodyHtml = HtmlService.createHtmlOutput(scGmailContactMessageBody);已經getBody()返回了一個 HTML 字符串。



查看完整回答
反對 回復 2023-03-10
?
慕容森

TA貢獻1853條經驗 獲得超18個贊

從問題

我嘗試添加{htmlBody: html}作為選項,但會引發html未定義的錯誤。

錯誤信息很直接,代碼不包含聲明語句html

嘗試替換htmlbodyHtml


查看完整回答
反對 回復 2023-03-10
  • 2 回答
  • 0 關注
  • 135 瀏覽
慕課專欄
更多

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號