![](/img/trans.png)
[英]Google Apps Script - How to send HTML email from Sheet?
[英]How to send html email with variable as “send to” address in Google Apps Script
我正在嘗試使用Google Apps腳本發送HTML文檔作為電子郵件。 我設置了一個變量,用於向提交我的表格的任何人發送電子郵件。
var emailVariable = "example@email.com"
MailApp.sendEmail({
to: emailVariable,
subject: "Example Subject",
htmlBody: email_html
});
volSentEmail.setValue("✓");
}
我希望它能發送電子郵件,但出現錯誤:
Error
Aug 14, 2019, 11:36:18 PM
Invalid email: [L<?>;@2869b373
at sendEmail(Code:123)
at newSumbission(Code:305)
我試過將發送電子郵件更改為電子郵件字符串,而不是變量,並且工作正常。
我們會收到包含您的代碼的電子郵件。 如下所示,我們僅對其進行了修改,以添加email_html
變量並注釋掉volSentEmail
(因為它似乎與我們的問題無關)。
var email_html = "In efficitur sem non nisl fringilla finibus.";
var emailVariable = "example@mail.com";
MailApp.sendEmail({
to: emailVariable,
subject: "Fusce scelerisque tempor dui at molestie",
htmlBody: email_html
});
// volSentEmail.setValue("✓");
有了這些信息,我們可以排除sendEmail
方法或給定代碼的任何問題。 因此,問題必須超出此問題的范圍,可能在變量emailVariable
。 我們建議調試該變量以查找可能的重新聲明或類似問題。 我們希望這對您有用。 請不要猶豫,向我們提供更多信息以尋求進一步的幫助。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.