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

email.setPlainTextBody() and email.setHtmlBody() together.

I looks like Messaging.SingleEmailMessage provides both of these methods.  I was wondering if I can set both the plain text and the html for this email.  Then, depending on the recipient's email configuration, one's email reader will choose the appropriate content.  Thanks in advance.


That's the right behavior, you can define both.

The email sent will contain both.

The client email reader with use only one


I assume that I just need to make those two calls.  I don't have to set anything else, right?  


You make those two calls, call setToAddresses(), call setSubject() and then sendEmail()

Yes ptran123 that's correct.  If you are using a template instead then you do not set those two properties.