Salesforce: Single Email Example

I didn’t use email functionality for a while; so I could hardly remember how to implement this and spent some time trying to find this again; that’s why I decided to store this here for any future references.


Messaging.SingleEmailMessage mail = new Messaging.SingleEmailMessage();
mail.setToAddresses('test_email1@test.test test_email2@test.test'.split(' '));
mail.setSubject( 'Test subject' );
mail.setHtmlBody( '<b>some html body</b>' );
Messaging.sendEmail(new Messaging.SingleEmailMessage[] { mail });

Enjoy

This entry was posted in apex, email, example, mail, Posts in English, salesforce, send and tagged , , , , , , . Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s