+ Start a Discussion
ptran123ptran123 

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.

AdminBoosterAdminBooster

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

The email sent will contain both.

The client email reader with use only one

ptran123ptran123

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

AdminBoosterAdminBooster

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

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