SEND MAIL WITH FILE ATTACHED

PHOTO EMBED

Wed May 18 2022 10:19:28 GMT+0000 (Coordinated Universal Time)

Saved by @mdfaizi #javascript

var senderId = -5;
var recipientEmail = 'notify@myCompany.com';
var timeStamp = new Date().getUTCMilliseconds();
var recipientId = 12;
var fileObj = file.load({
id: 88
});
email.send({
author: senderId,
recipients: recipientId,
subject: 'Test Sample Email Module',
body: 'email body',
attachments: [fileObj],
relatedRecords: {
entityId: recipientId,
customRecord:{
id:recordId,
recordType: recordTypeId //an integer value
}
}
});













//EMAIL BODY

var emailBody = 'Dear ' + nextApprName + ',';

                emailBody += '<br/><br/>There is Vendor Bill pending for your urgent action. Kindly review the transaction.';

                emailBody += '<br/>Transaction Number: ' + tranId;

                emailBody += '<br/>Vendor Name: ' + vendorName;

                emailBody += '<br/>Subsidiary: ' + subsidiary;

                emailBody += '<br/>Transaction Date: ' + tranDate;

                emailBody += '<br/>Currency: ' + currency;

                emailBody += '<br/>Amount: ' + amt;

                emailBody += '<br/>Vendor Bill #: <a href="' + billRecUrl + '">' + refNo + '</a>';




emailBody += '<br/>Vendor Bill #: <a href="' + billRecUrl + '">' + refNo + '</a>'; 
do this to give a name to that the link will be hidden in the name.





content_copyCOPY

How to format email body ,how to hide url inside its name i.e hyperlink