I'm creating leads from web-to-lead and through API in Salesforce and want to send specific email based on the lead data. For this I have written a trigger to send email after inserted in Salesforce. But the trigger does not sent the email from APEX. Why is it so?

  • Have you tried debugging the trigger? Did you see any errors in the console? Anyways, I bet you could accomplish this using a Process builder and an Email alert.
    – SatyaV
    Jan 24, 2018 at 14:57
  • Are you getting the Lead source from web-to-lead from API. Depending upon values write workflows. Trigger not sending email might be as its a sandbox and deliverability is set to "No Email"?
    – Prasanna
    Jan 25, 2018 at 7:49

1 Answer 1


If its a sandbox, check the value set for Email Deliverability. It might be set to "No Email" or "System Only"

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .