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
tukmoltukmol 

Image tag in an email

Why is salesforce adding an image tag to dynamically generated HTML email? It's causing us issues (Outlook).

 

Here's very simple code to with HTML generated content:

Messaging.Singleemailmessage mail;
mail = new Messaging.Singleemailmessage();
mail.setSubject('TEST 123');
mail.setHtmlBody( '<html><h1>THIS IS JUST A TEST</h1></html>');
mail.setSaveAsActivity(false);
mail.setTargetObjectId(UserInfo.getUserId());
Messaging.sendEmail(new List<Messaging.Singleemailmessage> {mail});

 When i execute this, it adds an image tag right before the closing HTML (</html>).

 

How to workaround this? Why is this?

 

Thanks

 

 

Best Answer chosen by Admin (Salesforce Developers) 
InsightTeamInsightTeam

I believe that's the web beacon.  You might be able to turn it off by going to Setup ->Activity -> Activity Settings -> Uncheck Enable Email Tracking.

All Answers

InsightTeamInsightTeam

I believe that's the web beacon.  You might be able to turn it off by going to Setup ->Activity -> Activity Settings -> Uncheck Enable Email Tracking.

This was selected as the best answer
tukmoltukmol

then that disables an org-wide feature that we need :(