1

I have below HTML custom email template where the image insertion is failing. Can someone please help me?

Code

<html><table height="400" width="550" cellpadding="5" border="2" cellspacing="5">
<div style="width:550px;height:20px;font-size: 20px;border:1px solid #000;text-align: center;background:#F2D9B1;">Order Rejection Notification</div>
<tr height="400" valign="top">
<td style="color:#000000;font-size:12pt; background-color:#FEFCC9; font-family:arial;">
<p class=3DMsoNormal></p>

<p class=3DMsoNormal style=3D'margin-bottom:12.0pt'>This message serves as
confirmation that a recent order from within your territory was unable to
process due to the following reason(s):</p>

<ul type=3Ddisc>
 <li class=3DMsoNormal style=3D'mso-margin-top-alt:auto;mso-margin-bottom-a=
lt:auto;
     mso-list:l0 level1 lfo1;tab-stops:list .5in'><span style=3D'mso-fareas=
t-font-family:
     "Times New Roman"'>{RejectReason}</span></li>
</ul>

<p class=3DMsoNormal style=3D'margin-bottom:12.0pt'><br>
Sample Request Form Order <b>{OrderNo}</b> was rejected in <b>{Territory}</b> for <b>{Owner}</b>.<br>

<br>
<strong>Order Details:</strong><br>
<br>

Source Profile ID: {HCPProfileId}<br>
{HCPName}<br>
{ShipAddress1} <br>
{CityStateZip}</p>
<table class="MsoNormalTable" border="1" cellspacing="0" cellpadding="0">
<tbody><tr><td style="padding:0in 0in 0in 0in"><p class="MsoNormal" align="center" style="text-align:center"><b>NDC </b></p></td>
<td style="padding:0in 0in 0in 0in"><p class="MsoNormal" align="center" style="text-align:center"><b>Product Description</b></p></td>
<td style="padding:0in 0in 0in 0in"><p class="MsoNormal" align="center" style="text-align:center"><b>Ordered Quantity</b></p></td>
</tr>
<tr><td style="padding:0in 0in 0in 0in"><p class="MsoNormal">{NDC}</p></td>
<td style="padding:0in 0in 0in 0in"><p class="MsoNormal">{ProductName}</p></td>
<td style="padding:0in 0in 0in 0in"><p class="MsoNormal">{Qty}</p></td>
</tr>
</tbody>
</table>
<p class="MsoNormal"><br>

<br>
Thank you,<br>
iREP Team<br>
<br>
Please do not reply to this e-mail. This e-mail is for your information only.</p>

<p><img src="{!$Resource.Humira}" width="200" height="30" style=”display:block;” border=”0″/></p>
</td></tr>
</table></html>
3

I'm going to assume that this is the image you're referring to:

img src="{!$Resource.Humira}

I'm guessing that Humira is actually a zip file and not the name of the image. Your code should include the path to the file from within your static resource. The zip file must also be set to "Public" so others outside your org can view it. Your code should look something like below:

<apex:image id="theImage" value="https://c.instance>.content.force.com/servlet/servlet.ImageServer?
  id=<document_id>&oid=<organization_id>" width="200" height="200"/> 

For more, see this KB Article.

  • I don't have an apex page here. I need it only in html. :) – Testing_SFDC Dec 2 '16 at 8:28
  • Let me first say that apex:image is the equivalent of html's <img> tag where value and src would also be equivalent. Is this a visualforce email template or a template for use with outbound email via services other than Apex? If the latter, see this KB article. – crmprogdev Dec 2 '16 at 19:41

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.