I have a Visual force page to display certain fields in a certain format. As part of this the page also has a Rich Text Field. There are two buttons on the page, one to send the page as email and the other to download the page as PDF.

When a image is uploaded into the rich text field below is the behavior.

  • The PDF looks good with the image in it and i was able to download without any issues.

  • Everything looks good on the email except there is no image on the email from the RTF. It displays a little broken place holder icon rather than a image

I see some similar explanation found in a SFSE thread that is little close to what i need. How do I insert an image from a Rich Text field in an html email template

Is there a workaround for the issue or am I missing something because i was able to download the PDF with the image without any issues ?

Below is relevant code:


<apex:pageBlock rendered="{!displaydetails}">
    <div style='font-size:10pt;font-weight:bold;'>Meeting Details:</div>
    <hr width="25%" align="left"></hr>
<!-- details is the apex string for the RTF used here after nullcheck on server -->
<apex:outputText style="font-size:10pt;" value="{!details}" escape="false"/>


// This method is called to send an email
public PageReference sendEmail() {
    system.debug('SEND EMAIL PRESSED');
    PageReference pdf = Page.SLA_HTMLCallReport;
    Blob b = Blob.valueOf('');
        b = pdf.getContent();
    String[] toAddresses = new List<String>();
    for (String item : recipients.split(';') ) {
    Messaging.SingleEmailMessage email = new Messaging.SingleEmailMessage(); 
    email.setSubject( subject );
    email.setToAddresses( toAddresses );
    email.setHtmlBody( body + '<br/><br/>' + b.toString() );
    Messaging.SendEmailResult [] r = Messaging.sendEmail(new Messaging.SingleEmailMessage[] {email}); 
    emailSent = true;      
    return null;
//This method is called for saving as pdf
public PageReference savePDF() {
    PageReference pdf = Page.SLA_PDFCallReport;
    return pdf;

1 Answer 1


I'm fairly sure that the problem here is that when you try to access the image on the email you are using the Salesforce internal link (the one that requires authentication).

When rendering PDFs you don't get this issue because the images are embedded into the file, so no authentication is required to view them.

Similar issue faced here, with rendering MS Word documents.

You could also:

  1. Make the Visualforce publicly available, and give the guest user access to the data displayed (careful with this, you might want to provide some kind of authentication for your users to see the data).
  2. Host the images in another service, and refer to their links in your field. Since the Rich Text Area field is just plain HTML, you can modify the image link to point to, say, Imgur or a AWS S3 bucket instance.
  • Thanks for your help! I agree with what you are saying, but the blob for my email has PDF as source so shouldn't the PDF already have the image in it? Jul 2, 2018 at 13:45
  • 1
    From your text I understood that there were two actions to the button, one to preview the page as PDF (and which is working correctly) and another to send the page on the email (not as a PDF, but as the email body, and which is giving you this headache). Jul 2, 2018 at 16:49
  • 1
    If you want to send the PDF on the email, I think you should first save the page as PDF on an attachment and then attach this object on the email message. Jul 2, 2018 at 16:50
  • To your point yes, I'm using two separate buttons, but if you see my code I'm using pdf.getContent() as a blob for my email! So based on what I'm hearing is its just not possible to embed the image in email for the rich text field directly. I have multiple rich text fields on my page. Jul 2, 2018 at 17:02
  • Your conclusion is correct. It is not possible to expose the images the way you are doing. You either serve them from an external service or embed them in your message (like rendering the PDF and sending as an attachment). Jul 2, 2018 at 18:40

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .