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
Anton FlärdAnton Flärd 

EmailMessage vs. InboundEmailHandler - what's the difference?

Hi

Seen code samples around the web and on this site either using EmailMessage or Messaging.InboundEmailHandler and I'm not sure which one to use.

What is their differences?
Best Answer chosen by Anton Flärd
Amit Chaudhary 8Amit Chaudhary 8
Please check  below post . I hope that will help you

SingleEmailMessage Vs MassEmailMessage
http://amitsalesforce.blogspot.com/2015/11/singleemailmessage-vs-massemailmessage.html

An Introduction to Email Services
https://developer.salesforce.com/page/An_Introduction_To_Email_Services_on_Force.com

I hope this will help you.

 

All Answers

ManojjenaManojjena
HI Anton,
Both are two standard salesforce classes .Basically if you want to send email you need to use SingleEmailMessage of MassEmailMessage class .
If you want to track the email comming to salesforce then you need to use InboundEmail class .
Both classes are in Messaging Name space .To know more detail about all above please check belwo link
https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_namespace_Messaging.htm

Let me know if it helps !!
Thanks
Manoj
 
JeffreyStevensJeffreyStevens
I know about InboundEmailHandler.  I use it when I want to be able to receive an email and do stuff with it.  The Email handler will create an email address that receives emails, and it points to a email handler class.  That class executes when the email is received. You can read all the information about the email, including the body and header info.
Amit Chaudhary 8Amit Chaudhary 8
Please check  below post . I hope that will help you

SingleEmailMessage Vs MassEmailMessage
http://amitsalesforce.blogspot.com/2015/11/singleemailmessage-vs-massemailmessage.html

An Introduction to Email Services
https://developer.salesforce.com/page/An_Introduction_To_Email_Services_on_Force.com

I hope this will help you.

 
This was selected as the best answer