My case is i want to send email with attachment in custom object using single email message using HTML Email Template (with letterhead).
Current condition i successed to make the email same like email template (HTML body) by using these methods:
email.setToAddresses(emailResults); email.setTargetObjectId('0055D000001DHyJ'); //user id email.setTreatTargetObjectAsRecipient(false); email.setTemplateId(tem.Id);
But the problem is, fields in email template become blank. For Example:
I also try use .replace but it make email body become blank.
Is there any solution or workaround for this case?