+ Start a Discussion
sfdcsushilsfdcsushil 

triggerUserEmail email header not sending emails for Tasks

Hello,

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. 
nikvmnikvm
Chekc your email Deliverability settings. Make sure Access Level is set to All Emails. 
sfdcsushilsfdcsushil
Email Deliverability is correctly set to All Emails. FYI, Its working fine when you create task manually and select sent notification to assignee. 
nikvmnikvm
I found this article https://help.salesforce.com/apex/HTViewSolution?id=000176854&language=en_US
did you happen to have a look. 
 
nikvmnikvm
usinf @future might help.