Have you ever wanted to send a more personalized email to a customer or client with information about their representative at your company? This article will explain how to send an email to a Lead or Contact containing a dynamically added image of their record owner.
You can associate an image with a user record by placing a link to the image in the Photo URL Field. If you do not have a photo URL field on your user records, you can add it by More Records ellipsis button on the record and selecting Form Editor. Then find the photo URL field in the field list on the User form, drag and drop it onto the form, then save and publish the change. You'll need to have the image hosted online somewhere and then in the user records put the URL for that user's image in the field. It is recommended that you upload those images in the size you want them to display in the email.
First, using the Image Manager, insert an image that is the same width and height that you'd like the user record image to be into the email template as a placeholder. Next, right click on the image and in the URL field, delete the placeholder photo's URL and replace it with the FreeMarker text for the Photo URL field: ${Recipient.systemuser.photourl[0]!''}
NOTE: Since we are using FreeMarker as part of a URL, be sure to replace the quotation marks that are included in the FreeMarker text by default with single quotes instead. The quotation marks would cause a render error because they will erroneously be treated as the end of the URL when the HTML is processed.
The image in your template will now NOT display because the URL is not populated until the email is sent. It will also NOT display if you TEST the email. When you actually send the email the image will display in the same location where you initially placed the placeholder image.
An alternative method to display the image is to place an image tag into your email template's HTML and use ${Recipient.systemuser.photourl[0]!"} as the img src. Note that the quotes there are two single quotes.
<img src="${Recipient.systemuser.photourl[0]!''}" width="299" height="299">