Method: generateEmail
Last updated
Was this helpful?
Was this helpful?
public static String generateEmail(Id templateId, Id recordId, List<Id> sdocIdsToAttach, Boolean enforceSharingRules)String htmlBody = SDOC.DocumentSDK.generateEmail(emailTemplateId, oppId);
Messaging.SingleEmailMessage mail = new Messaging.SingleEmailMessage();
mail.setTargetObjectId(userContactId);
mail.setHtmlBody(htmlBody);
mail.setSubject('Your Custom Quote');
Messaging.sendEmail(new Messaging.SingleEmailMessage[] { mail });SDOC.EmailOptions options = new SDOC.EmailOptions();
options.toAddresses = new List<String>{'client@example.com'};
options.ccAddresses = new List<String>{'rep@company.com'};
options.sdocIdsToAttach = new List<Id>{'a00xxxxxxxxxxxx'}; // ID of an existing S-Doc record
String serializedMail = SDOC.DocumentSDK.generateEmail(templateId, recordId, options);
// Note: To send this, you must deserialize it back to a SingleEmailMessage object