You need to sign in to do that
Don't have an account?
sending email from apex (in LEX) not populating Classic Email Template
I'm sending emails generated in Apex from Lightning. The emails are sending but they're coming through without an email body, despite a classic email template being set.
The SendEmailResult generated by the system.debug shows...
getTemplateId is showing the correct id for the Classic Email Template.
So -- all is perfect, except the template isn't coming through in the email.
What am I missing?
Thanks,
Steve
EmailTemplate template = [Select id, subject from EmailTemplate where name = 'My Template' limit 1]; ... Messaging.SingleEmailMessage msg = new Messaging.SingleEmailMessage(); msg.setTemplateId(template.Id); // <<--- look ... system.debug(Messaging.sendEmail(emails,false) );
The SendEmailResult generated by the system.debug shows...
15:34:51:342 USER_DEBUG [35]|DEBUG|Messaging.SingleEmailMessage[ getBccAddresses=null; getCcAddresses=null; getCharset=null; getEntityAttachments=null; getFileAttachments=null; getHtmlBody=null; getInReplyTo=null; getOptOutPolicy=SEND; getOrgWideEmailAddressId=0D20U0000008P2cSAE; getPlainTextBody=null; getReferences=null; getTargetObjectId=0030U00000eXdLNQA0; getTemplateId=00Xf4000000h8eaEAA; // <<--- look getToAddresses=null; getWhatId=null; isTreatBodiesAsTemplate=false; isTreatTargetObjectAsRecipient=true; isUserMail=false; ]
getTemplateId is showing the correct id for the Classic Email Template.
So -- all is perfect, except the template isn't coming through in the email.
What am I missing?
Thanks,
Steve
Can you share your code to get find it quickly.
Update your code as below:
Regards,
Harsh P.
Update your code as below:
Regards,
Harsh P.