Reputation: 119
I'm trying to send an HTML document as my email using Google Apps Script. I have a variable set up to send an email to whoever submits my form.
var emailVariable = "[email protected]"
MailApp.sendEmail({
to: emailVariable,
subject: "Example Subject",
htmlBody: email_html
});
volSentEmail.setValue("✓");
}
I would expect it to send the email but I get the error:
Error
Aug 14, 2019, 11:36:18 PM
Invalid email: [L<?>;@2869b373
at sendEmail(Code:123)
at newSumbission(Code:305)
I've tried changing the send email to an email string instead of a variable and it works fine.
Upvotes: 0
Views: 1414
Reputation: 2598
We can receive emails with your code. As you can see below, we only modified it to add a email_html
variable and comment out volSentEmail
(because it doesn't seems related to our problem).
var email_html = "In efficitur sem non nisl fringilla finibus.";
var emailVariable = "[email protected]";
MailApp.sendEmail({
to: emailVariable,
subject: "Fusce scelerisque tempor dui at molestie",
htmlBody: email_html
});
// volSentEmail.setValue("✓");
With this information we can rule out any problem with the method sendEmail
or the code given. Therefore, the problem must lay outside the scope of this question, maybe in the variable emailVariable
. We recommend debugging that variable to find out possible redeclarations or similar issues. We hope that this is useful for you. Please, don't hesitate to offer us more information for further help.
Upvotes: 1