I have developed an email service handler in which I am noticing some some of them showing null in the plainTextBody field although there is a body present. Below is my sample code
global Messaging.InboundEmailResult handleInboundEmail(Messaging.InboundEmail email, Messaging.InboundEnvelope envelope) {
Messaging.InboundEmailResult result = new Messaging.InboundEmailresult();
try{
System.debug('from email address = '+email.fromAddress);
System.debug('email subject = '+email.subject);
System.debug('plainTextBody = '+email.plainTextBody); //this is showing blank in logs
The forwarding inbox has a copy of the email forwarded to the email handler address and I see the body is present in the email. Initially I thought it was due to HTML content in the email but I tried a couple of emails with HTML content and they seem to show the body fine(with html markup as text).
Could it be because the email was encrypted by the sender?
htmlBody
? – Adrian Larson♦ May 6 '17 at 16:38