+ Start a Discussion
SalesforceCrm AccountCRMSalesforceCrm AccountCRM 

Send an email alert format in an sendemail message

Hello ,
Do we have an option to send an email alter format in a Send email message .
As in Email Alert ..we have
Subject Line
To ,From nd CC
In body we give the detailed description etc.
For example :I would like to send an email to the customer regarding an product .
So how can i get it formatted in an sendemail message .
Any example very much appreciated.

Atul GuptaAtul Gupta
Yes you can do that, you can set HTML as the email body like this
Messaging.SingleEmailMessage email = new Messaging.SingleEmailMessage();
email.setSubject('Test message');
email.setHtmlBody('<html><body><p>Some text</p><hr /><p>Some other text</p></body></html>');
email.setPlainTextBody('Test body');
Messaging.sendEmail(new List<Messaging.Email> { email });