What is the difference between SingleEmailMessage and MassMailMessage

What is the difference between SingleEmailMessage and MassMailMessage


SingleEmailMessage
MassMailMessage
The SingleEmailMessage can send message related to only single record.
MassEmailMessage can send mails related to multiple records (WhatId
and TargetObjectId).
setTargetObjectId – The ID
of the contact, lead, or user to which the email will be sent.
setTargetObjectIds – A
list of IDs of the contacts, leads, or users to which the email will be sent.
Used for single record
Used for multiple records
Messaging.SingleEmailMessage
Messaging.MassMailMessage

Leave a Reply