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

triggerUserEmail email header not sending emails for Tasks


I have some code which creates a  task for one user when an opportunity is created. during creation of tasks, i am setting up the Email header for sending emails. But emails are not being sent for some reason.

Code Snippet - 
          Database.DMLOptions dml = new Database.DMLOptions();
          dml.emailHeader.triggerUserEmail = true;
          database.insert(lstTasks, dml);

Can someone provide some pointers for fixing this issue. Thanks in Advance. 
Chekc your email Deliverability settings. Make sure Access Level is set to All Emails. 
Email Deliverability is correctly set to All Emails. FYI, Its working fine when you create task manually and select sent notification to assignee. 
I found this article
did you happen to have a look. 
usinf @future might help.