+ Start a Discussion

Email going twice when triggered

The challenge is that the email is going twice.


following is the code for sending email (part of class)


    Messaging.SingleEmailMessage mail = new Messag​ing.SingleEmailMessage();
    String[] toAddresses = new String[] {c.Client_​Email_Address__c};
    if(c.Client_Email_Address_Optional__c != null)​{
    String[] toAddresses2 = new String[] {c.Client​_Email_Address_Optional__c};
     EmailTemplate et = [SELECT id FROM EmailTempl​ate WHERE developerName = 'Dispute_Notification'];
    mail.saveAsActivity = true;
    Messaging.sendEmail(new Messaging.SingleEmailM​essage[] { mail });


i'd add some debugging and make sure that the trigger isn't being called twice (because of another trigger, workflow, etc). 


Ankit AroraAnkit Arora

Hi sylar20,


Please make sure this part of your code is not running in  a loop.



Ankit Arora

Blog | Facebook | Blog Page


Check your email settings:

From the let menu follow : Personal Setup --> Email--> Uncheck the Automatic Bcc on this screen


I faced the same issue and get solved in this way, let me know if it workd for you.