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
venkateshyadav1243venkateshyadav1243 

how to send email from trigger?

how to send email from trigger?

 

 

can any one help me how to i write trigger am new to trigger can any write code take two example and help me

 

 

thanks for advance alll.

SRKSRK

 

 

Messaging.SingleEmailMessage mail = new Messaging.SingleEmailMessage();
String[] toAddresses = new String[] {a.CreatedBy.Email};
mail.setToAddresses(toAddresses);
mail.setSubject('Apex Sharing Recalculation ' + a.Status);
mail.setPlainTextBody
('The batch Apex job processed ' + a.TotalJobItems +
' batches with '+ a.NumberOfErrors + ' failures.');
Messaging.sendEmail(new Messaging.SingleEmailMessage[] { mail });

 

but there is a limit u cna not send more then 10 email in one run

venkatyadav127venkatyadav127

thanks for your reply

 

 

 

i have to write trigger on opportinuty

 

in opportunity when the stage field selected closed won i have to send email for that person contact detail 

 

 

plz any one have idea plz help me

 

thanks for advance to all

sfdcchampionssfdcchampions

I believe you can achieve this via Workflow ( with action Email)...

 

hope that hepls..