i want to send email using google script but contains multiple hyperlink and text
function jira() {
var ss =SpreadsheetApp.getActiveSpreadsheet();
var jira = ss.getSheetByName('Mailer');
var currentEmail = "emailhere@gmail.com"
var status = jira.getRange("C1").getValue();
var total_ticket = jira.getRange("C2").getValue();
var jira_ticket =jira.getRange(3,3,jira.getLastRow()-2,1).getValues();
var subject = "[AUTOMATION MAILER] Pending JIRA Ticket - Change Phone Number"
var body = "Hi Leaders\n\n" +
"There is "+total_ticket+" pending tickets on jira. Kindly solve this ticket_id : <a href='" + jira_ticket + "'>agenda</a>"+
"\n\n\nBest Regards"
Logger.log(body)
if(status=='Yes'){
MailApp.sendEmail({
to: currentEmail,
subject: subject,
htmlBody:body
});
MailApp.sendEmail(currentEmail,subject,body,)
}
}
here is the sheet looks like. i want all the jira ticket clickable in email
This will create drafts with hyperlinks. From that you should be able to create emails.
function creatDataList() {
const ss = SpreadsheetApp.getActive();
const sh = ss.getSheetByName('Sheet0');
sh.clearContents();
let uA = [];
for (var i = 0; i < 5; i++) {
let url = `http://domain${i}.com`;
let add = `name${i}@domain${i}.com`;
let sub = `Subject${i}`
uA.push([url, add, sub]);
}
sh.getRange(1, 1, uA.length, uA[0].length).setValues(uA);
}
function createDrafts() {
const ss = SpreadsheetApp.getActive();
const sh = ss.getSheetByName("Sheet0");
const vs = sh.getDataRange().getValues();
vs.forEach((r, i) => {
GmailApp.createDraft(r[1], r[2], '', { htmlBody: `This is a fake link: <a href="${r[0]}">${r[0]}</a>` });
});
}