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
EchoEchoEchoEcho 

Allow for Content-ID header to be set on Messaging.EmailFileAttachment

Wondering if anybody has figured out a way to do this...

 

From what I can tell, right now, the only way to specify an attached image in an email from Apex is to use setInline(true) on an EmailFileAttachment, and this generates a "Content-Disposition: inline" header in the email which is promptly ignored by pretty much every email client. Giving the ability to set a Content-ID header would allow the developer to embed an attached image into the body of an email.

 

 

For instance, this Content-ID is an example from Gmail:
Content-ID: <ii_12e92eb7a7875474>

 

 

 

It can be referenced in the html body of the email with:

<img src="cid:ii_12e92eb7a7875474">

 

 

Is this possible in Apex at all?

 

Thanks,

Tom