following is the code for sending email (part of class)
Messaging.SingleEmailMessage mail = new Messaging.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}; mail.setCcAddresses(toAddresses2);} mail.setToAddresses(toAddresses); EmailTemplate et = [SELECT id FROM EmailTemplate WHERE developerName = 'Dispute_Notification']; mail.setTemplateId(et.id); mail.setTargetObjectId(c.ContactId); mail.setwhatId(c.Id); mail.saveAsActivity = true; mail.setOrgWideEmailAddressId('0D2S0056674CiI'); Messaging.sendEmail(new Messaging.SingleEmailMessage[] { mail });
i'd add some debugging and make sure that the trigger isn't being called twice (because of another trigger, workflow, etc).
chris
Hi sylar20,
Please make sure this part of your code is not running in a loop.
Thanks
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.