Google Sheets – How to Set Links in Email Body

gmailgoogle sheetsgoogle-apps-script

I have script that sends an email from google sheet and want to have link in the email's body
but code like

var html_link = "google.com";
var body = "<a href=" + html_link + ">Google</a>"
MailApp.sendEmail(email1,subject ,body, {attachments:[{fileName:"RdS "+datet+ ".pdf", content:contents, mimeType:"application//pdf"}]});

give me same code in email body, not the link. So email body looks like this
Google

Where I am wrong?

Best Answer

ok, I learned that you need to apply htmlbody like

var contentHTML = "<body> <font color='red'> <b>SUPERVISOR!</b> \n \n <p> <b> REVISA EL PLAN/FACT DE LA SEMANA</font></b> </p><br> <a href='" + urlsheet + "'>CLICK PARA SIGUIR A LOS REPORTES DEL TURNO</a> </p><br> </body>"
GmailApp.sendEmail(email1,subject ,body, {htmlBody: contentHTML});

now it works