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
dho1dho1 

Calling an Email Service from Apex

Hi,

 

I've developed APEX code to call an email service, which in turn calls a batch APEX job.  This works if I manually forward the email created by the APEX code to the service address. However I cannot see the batch job on the apex scheduler when the APEX code sends the email directly to the service address.  

 

I've tried messing around with the service address by adding my domain and removing it, and neither case worked.  I've also tried turning on and off the advanced security settings.

 

Any ideas? 

Best Answer chosen by Admin (Salesforce Developers) 
dho1dho1

Figured it out.  Apparently I have a custom settings that stored the service email address, in which the type was set to Email, and couldn't handle the length of the services address.  When I changed it to Text(255) things worked beautifully.

All Answers

Jia HuJia Hu
Have you implemented the Schedulable Interface and call the Apex through the Apex Scheduler?
dho1dho1

Hi Jia, The target class implements Database.Batchable.

dho1dho1

Figured it out.  Apparently I have a custom settings that stored the service email address, in which the type was set to Email, and couldn't handle the length of the services address.  When I changed it to Text(255) things worked beautifully.

This was selected as the best answer