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
Swetha A 5Swetha A 5 

display image fields in email template

I have two rich text fields in user object which holds two images in it. I want to build an email template(custom or VF template) to display those two rich text fields in it and when I send an email using that template, those two images need to be displayed. it is an urgent requirement. Please help. Thanks in advance.
Swetha A 5Swetha A 5
Hi All,
This is what I tried.

Visualforce Email template:
<messaging:emailTemplate subject="subject" recipientType="User" relatedToType="User">
<messaging:HtmlEmailBody >
<html>
<p>
Friend,

A quick reminder that the price of the Storyline Conference goes up in a few hours. Register right now and get the discount, then make your travel plans and join us. If you register right now, you’ll spend the next 5 weeks in eager anticipation. Everything changes in Chicago on November 5th. It’s going to be GREAT.

See you soon in Chicago!
</p>
<table>
<tr>
<c:RichTextComponent ></c:RichTextComponent> 
</tr>
</table>

</html>

</messaging:HtmlEmailBody>
</messaging:emailTemplate>
Here is my apex component:
 
<apex:component controller="RichText" access="global">
<apex:attribute type="string" name="type" description="specify header and footer type" />

        <apex:outputField value="{!objUser.Photo__c}"/>
        <apex:outputField value="{!objUser.signature__c}"/>
</apex:component>
Apex class:
public class RichText {
    
    public User objUser { get; set; }
    
    public RichText() {
        objUser = [SELECT Photo__c, signature__c FROM User WHERE Id =: Userinfo.getUserId()];
    }
}

I am able to get the images in HTML preview. But when I test by sending a test mail to me, I am not able to get the images in the email.
Here is the screen shot.
User-added image

Please help in solving this.. Thanks in advance.
Shweta GargShweta Garg
Hi Swetha A 5,

Did you get the workaround to solve this problem.I need exactly same.
Please share with us if you find the solution.

Thanks in advance.