How to Send Email from Apex class?

How to Send Email from Apex class?

The setSubject() function sets the subject of the mail and the setHtmlBody() sets the body of the mail in HTML form. If you want to set body in text form then use the function setPlainTextBody() function. To send the mail simply use the sendEmail() function of the Messaging class.

How to Send Email alert using Apex?

Add the Immediate Action for this Criteria.

  1. Click on Add Action and select Apex as Action Type.
  2. Enter the Action Name and Select EmailController as Apex Class.
  3. Click on Add Row. Select strRecipientId Field and pass Id of the Contact.
  4. Click on Save and Activate the Process.

How to schedule Email in Apex?

For this make an Apex Scheduler Controller and to schedule this controller go to… Administration Setup->Monitoring->Scheduled Jobs from there we select that Controller class and then provide some time and date to execute it in future.

How to write schedulable apex class to send email?

In particular, consider API bulk updates, import wizards, mass record changes through the user interface, and all cases where more than one record can be updated at a time. Though it’s possible to do additional processing in the execute method, we recommend that all processing take place in a separate class.

Is it easy to send an email with apex?

Sending an email with Apex is easy because you always follow the same template: // Step 4. Set email contents – you can use variables!

Can a callout be made from scheduled apex?

Synchronous Web service callouts are not supported from scheduled Apex. To be able to make callouts, make an asynchronous callout by placing the callout in a method annotated with @future (callout=true) and call this method from scheduled Apex. However, if your scheduled Apex executes a batch job, callouts are supported from the batch class.

How to send more than 10 emails using batch apex.plz?

Thank you all for your help. How to send more than 10 emails using batch apex .Plz help. string s=’Blocked’;