function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Ahmed Ansari 13Ahmed Ansari 13 

Html email status(EmailMessage) record not created in production

i have sent Email Using the below code
 
Lead ld = [select id, email, lastname from lead where id=:'00Q0r000001y0d6'];
Messaging.SingleEmailMessage mail = new Messaging.SingleEmailMessage();
        mail.setTemplateId('00X0r000000E7C9'); // Html Template Id
        mail.setTargetObjectId(ld.Id); //Lead id
       
        Messaging.sendEmail(new List<Messaging.SingleEmailMessage>{mail});

Thanks
Ahmed Ansari
sachinarorasfsachinarorasf
Hi Ahmed,

You can go through the following link it may helpful for you to create the status record. 

https://salesforce.stackexchange.com/questions/255676/html-email-status-wont-get-created-if-setwhatid-for-messaging-singleemailmess

I hope you find the above solution helpful. If it does, please mark as Best Answer to help others too.

Thanks and Regards,
Sachin Arora
www.sachinsf.com