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
timomertimomer 

Tests for InboundEmail class

Hello,

 

I have built a InboundEmail class that takes an email and inserts a record into a custom object. 

 

I need to build a test method for this but have no idea how, can I send it a fake email?

 

any suggestions appreciated!

 

many thanks,

Tim

Best Answer chosen by Admin (Salesforce Developers) 
JimRaeJimRae
there is a good sample on the wiki here

All Answers

JimRaeJimRae
there is a good sample on the wiki here
This was selected as the best answer
timomertimomer

thank you for that, I was able to modify it to do my tests.

 

fyi for anyone else...

email.PlainTextBody = if you need to set body in the text

 

also, if you need to test from address you need to set it in two places...

email.fromAddress =

env.fromAddress =

 

thanks!