user2725633
user2725633

Reputation: 1

Hyperlink not working in Google Script

I'm trying to insert a hyperlink in a google script but it returns the text clear without a hyperlink. Check below:

if (emailSent != Email_Sent) {
      if (visitType == "Taking") {
        var subject = "Equipment Checked out from Storage";
        MailApp.sendEmail(emailAddress,
                          subject,
                          "Hello" +
                          "\n\nThis is a reminder for myself " + emailAddress + 
                          "\n\nI am " + visitType + " " + amount + " x " + equipment + 
                          "\n\nRemember to return it within 15 days unless i want to keep the equipment" + 
                          "\n\nThanks" +
                          "\n\n For the sake of improving our service, please complete the feedback form " + **<a href="https://docs.google.com/a/1234/sharing/.."> here </a>);**

Upvotes: 0

Views: 218

Answers (1)

Nick
Nick

Reputation: 702

var url = "https://docs.google.com/a/1234/sharing/..";

"\n\n For the sake of improving our service, please complete the feedback form <a     href="+url+">here </a>");

You have to make sure the HTML you include is actually apart of the message, not outside of it.

I would also put the entire message in a message variable so the MailApp is rather clean. You also need to add a special attachment to make the html work. An example would be this:

MailApp.sendEmail(email,subject,message,{htmlBody:message});

Upvotes: 1

Related Questions