“NO_MASS_MAIL_PERMISSION” Error While Sending Email From Apex

If you are getting this error message while sending email using “Messaging.SingleEmailMessage”

System.EmailException: SendEmail failed. First exception on row 0; first error: NO_MASS_MAIL_PERMISSION, Single email is not enabled for your organization or profile. Single email must be enabled for you to use this feature.: []

Step to resolution

Make sure Email Deliverability is turned on.

Go to Setup –> Email Administration –> Deliverability