You need to sign in to do that
Don't have an account?
Yogesh Biyani
How do remove the email message after it is sent
In compliance with GDPR, we have implemented a process to delete all the user information from the database. After deleting the data we send a final email to the requester informing the actions taken. However, the final email message stays in the database and has the email address of the recipient. How can we delete the email after it is sent?
Here is the code which sends the confirmation email.
Here is the code which sends the confirmation email.
public void SendConfirmationEmailMessage(Contact_Preference__c cp){ Messaging.SingleEmailMessage message = new Messaging.SingleEmailMessage(); message.toAddresses = new String[] { cp.Email__c }; message.setSubject('Data Deletion Confirmation Email'); message.setHtmlBody(Messaging.renderStoredEmailTemplate('00X1W000001USk9', null, cp.id).getHTMLBody()); Messaging.SingleEmailMessage[] messages = new List<Messaging.SingleEmailMessage> {message}; Messaging.SendEmailResult[] results = Messaging.sendEmail(messages); if (results[0].success) { System.debug('The email was sent successfully.'); } else { System.debug('The email failed to send: ' + results[0].errors[0].message); } }
Yogesh
But I believe you can't delete using this way :
Please follow the below approach:
Can you list the field data that you are passing in parameters