I have quite simple code that sends a message with HTML body to a user. Here it is:

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 });

The problem is that the final message I receive in Outlook has some extra HTML code added (the IMG tag at the end). The link does not reference an existing image and I see just an empty placeholder. Here is the actual HTML received by the mail client:

<meta http-equiv="Content-Type" content="text/html; charset=utf-8"></head>
<body><p>Some text</p><hr><p>Some other text</p></body></html><img src="http://cs1.salesforce.com/servlet/servlet.ImageServer?oid=00DS0000003JTBq&amp;esid=018S0000000LTYn">

How to get rid of this extra IMG tag?


You cannot remove this image tag as it is used by Salesforce to know whether the email has been opened or not for the HTML Email Status. Some information around this can be found here.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.