Stack Overflow Asked by Pablopistachioo on November 15, 2021
function sendEmail(fullName, email, newStage) {
var firstName = fullName.split(" ")[0]
var URL = "https://calendar.google.com/calendar/selfschedsstoken=UUsweS1BdS0zOFBXfGRlZmF1bHR8YjJhNmFkNTEwOWFlODZhODRiNGZhYjk4ZjE0N2EwOGY"
switch (newStage) {
case "Stage 1":
var email_subject= "Update ";
var email_HTMLbody = "Hey " + firstName + "n nThank you for applying ! Upon reviewing your application, we would like to invite you to move forward with our interview process."+ "n nThe next step is to schedule a phone call with one of our mentors. The information we need from you can be found broken down below:" + "n n1).Please pick an interview time within the next two weeks that work for you. A link to our interview slots can be found <a href="https://calendar.google.com/calendar/selfsched?sstoken=UUsweS1BdS0zOFBXfGRlZmF1bHR8YjJhNmFkNTEwOWFlODZhODRiNGZhYjk4ZjE0N2EwOGY">here </a>
+"n n2).Before your interview, an email will be sent out with a link to Google Meet for you to join 10 minutes prior. These links will be sent to the email you mentioned in your application form." ;
MailApp.sendEmail({
to: email,
subject: email_subject,
htmlBody: email_HTMLbody
});
break;
}
}
Your getting an unexpected identifier because of the double quotes ("
) in the href
attribute in the <a>
tag.
Because you are using double quotes ("
) to create your string, when you try to use them in the <a>
, they are ending your string literal.
You currently have:
var email_HTMLbody = "Hey " + firstName + "a lot of text... then <a href="someurl
^ ^
end of string| |
this is unexpected|
You could escape the double quotes in the href
with a backslash before the double quote ("
):
var email_HTMLbody = "... <a href="someurl">click me </a>"
or use backticks:
var email_HTMLbody = `... <a href="someurl">click me </a>`
Answered by dwmorrin on November 15, 2021
Perhaps, but the result I tried with the same code
It worked when n was put in
and the URL part of http was enclosed in single quotes.
Answered by officeforest on November 15, 2021
Get help from others!
Recent Questions
Recent Answers
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP