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
Big EarsBig Ears 

Inbound Email Handler - triggering/firing inconsistently

Dear all,

 

I've built an inbound email handling service in my sandbox which accepts emails, looks for a particular id and then will update the appropriate record. I've got a debugger running, but I seem to have an issue.

 

Sometimes an inbound email to the address will get registered and the debug log will spring into life (whereupon the code executed will succeed/fail accordingly), but sometimes nothing will happen at all. Another email sent to the same address simply won't get registered. There will be no de-bug log, no "failure" email returned, nothing. I've no way of knowing whether/where it's failing.

 

I don't think it's limit based, because I'm certainly not nearing my 1,000 email limit and sometimes the email will trigger the code and sometimes it won't.

 

Are there any other areas I could be debugging, asides from the debug console in Salesforce? Is there any way of knowing whether the email is hitting its target or not?

 

With thanks,

Andy

colemabcolemab

I recommend that you use the Setup -> Monitoring -> Debug Logs to see what happens when your code executes for email classes.  Sometimes the developer console doesn't seem to catch what you want to see.

AndyRouseAndyRouse

Colemab,

 

I've also been using that debug logs. It's also not triggering consistently there. But thanks for the response!

 

I have come to work this morning to find anumber of "delivery delayed" emails relating to the emails I sent to the address supplied by my Salesforce sandbox. Do people know if the sandbox email handlers have lower limits/less ability to handle inbound emails?

 

Andy

SammyComesHereSammyComesHere

Email Service -Failure Response Settings - Enable Error Routing

 

You can make use of "Enable Error Routing" and check if any mails are coming there.

 

Accept Email From should be blank and Advanced Email Security Settings should be unchecked for debugging

colemabcolemab

As far as I know, the limits should be the exact same.   However, it is possible that the email service runs at a lower priority in the sandbox and/or the server was just over loaded.

 

I have written and debugged a few inbound email classes w/o ever having this issue.

AndyRouseAndyRouse

 - Thanks for your response. I'd set up the error routing to direct to me, but still got no error messages. It's a mystery!

 

 - Thanks for your feedback. I may deploy it to a straight development org and see if the behaviour is any more consistent. I received emails this afternoon informing me that the emails couldn't be delivered with some debug code:

 

"Generating server: HUB500-LO-2.exch500.msoutlookonline.net

 

ponumber@4icc8sakzf037nmstturzoo3emx8lqtn5hzavbb8wx7jbew6.w-4ylpmaa.w.apex.sandbox.salesforce.com
#550 4.4.7 QUEUE.Expired; message expired ##"

 

I'm going to look into those error messages and see if they lead anywhere.....

crop1645crop1645

The only time I have seen this issue was when my inbundemailservice was configured to only accept emails from certain domains and the incoming email was from a domain outside the configured list