Hello I wrote a class which implements Messaging.InboundEmailHandler so I can store my Unhandled Exceptions in Salesforce for historical reporting. I tested it manually by sending an email to my EmailToApexHandler and I can see that the functionality is working.

However I'm trying to get an exception to fire (strictly for testing purposes before I deploy), but no email is sending out. I find it strange that I can't for the life of me get a legitimate Exception to send out. I have tried divide by zero, null pointers - which result in errors but no email is sent out to the Administration Setup > Apex Exception Email users and manual address.

  • Email Deliverability is on
  • My user is the last one to modify the problematic trigger

Update - Here is an example that finally worked for me. Any idea why the Exception email wouldn't fire 100% of the time? (The error obviously fires every time...)

    trigger throwException on Opportunity (before update) {
    Integer i = 5/0;
  • We need to see more of your code to have any hope of helping you here. – Adrian Larson Jun 23 '17 at 14:29
  • I don't think it would be helpful to post the code since that's not the underlying issue. What I need to figure out is to why Exceptions aren't notifying the users under Administration Setup > Apex Exception Email – rmarq423 Jun 23 '17 at 14:31
  • I have to admit that I have the same issue in summer 17 sandboxes. I wrote a simple trigger+handler that throws an NPE and then used SFDC API to insert the sobject. Apex Exception Email never delivered. Even after 5 days. – cropredy Aug 7 '17 at 16:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.