I have an email sender linked to a google sheets file as follows:
function sendEmail(form) {
const sSheet = SpreadsheetApp.getActiveSpreadsheet();
const file = DriveApp.getFileById(sSheet.getId());
const documentUrl = file.getUrl();
var toEmail = form.toAddress;
var ccEmail = form.ccAddress;
var subject = form.subject;
var message = form.message;
const folderId = "";
const ssId = sSheet.getId();
const returnFlag= 'blob';
if (form.process == "sendHotelRegistration"){
var fileName = "Hotel Registration Form";
var sheetId = sSheet.getSheetByName("Hotel Registration form").getSheetId();
var sheet= sSheet.getSheetByName("Hotel Registration form");
sheet.showSheet();
} else if (form.process == "updateRegistry"){
var fileName = "Hotel Contract Document";
var sheetId = "All";
}
var pdfFile = createPDF(folderId, ssId, fileName, sheetId, returnFlag);
MailApp.sendEmail({
to:toEmail,
cc:ccEmail,
subject:subject,
body:message,
attachments:[pdfFile]
});
}
I have 2 issues:
1- I want to add a signature including a logo to the email. So I need the company name in bold and the logo. I cannot work out how to insert an image or to have formatted text. I have read through a lot of posts and the following google documentation: https://developers.google.com/apps-script/reference/mail/mail-app
And I have tried to implement this in my code but I cannot get it to work.
Secondly, I have a variable set in my email body which retrieves a value from my google sheet document as follows:
html.contractorName = data.contractorName.toLowerCase();
However, I don't actually want lower case, I want title / proper case. I cannot though work out how to implement this, particularly bearing in mind that the contractor name may be two, three, four names long.
Thanks