Questions tagged [email-template]

Salesforce email templates come in a variety of shapes and sizes, ranging from Text to Visualforce. These email templates can be used through Salesforce through approval processes, workflows, etc to send email to users.

Filter by
Sorted by
Tagged with
35
votes
6answers
18k views

Using APEX to assemble HTML Letterhead Emails

I am looking to assemble an HTML Letterhead Email Template for an email service integration project. There are two sObjects that hold this information - EmailTemplate and BrandTemplate. ...
48
votes
1answer
36k views

Setting a from address in SingleEmailMessage

I want to set a from address in a salesforce SingleEmailMessage, but can't see a way to do this and there is no standard method described in the documentation. I want the email to be sent from ...
16
votes
4answers
13k views

whatId when using custom object

I am having an html email template which uses certain merge fields from a custom object. Now I am using following apex code to send certain emails to users. Messaging.SingleEmailMessage mail = new ...
23
votes
6answers
21k views

Passing custom string into a Salesforce email template.

I've stumbled upon a problem at the final stage of a new feature I was building (as always) I need to pass in a custom string into a salesforce template, however there doesnt seem to be a way of ...
2
votes
1answer
2k views

Access child object's fields in visualforce email template

Design problem - Implement an approval process on case, which sends email to approver showing some additional info, which should not be visible to case owner/agent (who clicked on "Submit for approval"...
8
votes
0answers
240 views

Salesforce doesn't merge fields on email sent in platform event context

I have a process that runs every day in the morning. It is a scheduled class that publishes a platform event. When this event is run by the system, it collects some records and sends emails to some ...
6
votes
2answers
5k views

Anyway to control Communities E-mail Welcome Message

We have an org that we are moving from Portals to Communities, the Communities Welcome E-Mail is sent to all user accounts when their user/account is created: From the Communities > Administration > ...
8
votes
1answer
6k views

Using a component to add attachments to visualforce email template and showing email link

We are trying to add attachments to an email template using a component. The code in the email template is: <messaging:emailTemplate subject="My Subject" recipientType="User" relatedToType="...
4
votes
0answers
948 views

Automated Process User Permissions

We are having some difficulty with permissions. Our admin has also posted on the success board. https://success.salesforce.com/answers?id=9063A000000eB7V, she also found this same posting: https://...
2
votes
1answer
769 views

Email Templates: Conditional Greeting Based on Time of Day

I'm attempting to set up an email template based on the time of day to begin an email with either a "Good Morning" or a "Good Afternoon" greeting based on the time of day that the email was sent. I ...
1
vote
2answers
4k views

Is is possible to display an image or icon in a Email using a Visualforce template?

I am trying to send an email using a Visualforce template and I want that template to include an icon. Is this possible?
0
votes
1answer
117 views

VF Email templates Boolean merge fields Automated Process User is always false

Use case: Trigger subscribes to Platform Event (hence running user = Automated Process) Trigger creates SObject w/ checkbox field set to TRUE Process Builder executes based on SObject values, ...
5
votes
1answer
1k views

How to change location of username and password in Customer Portal email

I have a very nice branded professional looking HTML email template for the New User Email Template for the email that gets sent for a new Customer Portal user. The issue is that SF just appends the ...
3
votes
3answers
9k views

Insert Attachment into Visualforce Email Template

this question: says that it is "hard" to put a component inside a visualforce email template because ' needs to be a child of component.'. Yet, is there a way to make this work? We also need to ...
12
votes
4answers
12k views

How can Email Template be created in unit tests?

Can I create an Email Template as part of the unit test? If yes, how?
8
votes
3answers
4k views

Can't set toAddresses on email when templateId defined?

Question Did something change recently with the SingleEmail methods that prevents using setToAddresses() when a template is used? Background I need to send an email to a user based and pass in the ...
5
votes
1answer
9k views

how to pass values from Visualforce Email Template to custom component

I have created a simple visualforce email template: <messaging:emailTemplate subject="** Inventory Wishlist Match Found **" recipientType="User" relatedToType="Inventory_Wishlist__c"> <...
1
vote
2answers
323 views

VisualForce apex:repeat Related Objects not rendering in VF Email

Thanks to Boris Bachovski , I was able to successfully get my VisualForce email to compile. However, when I fired off a test Email Alert, (this action was linked with the VF Template) the ...
3
votes
2answers
982 views

How can I put a line break in the text of an IF statement in a plain text email template?

I am trying to put a line break inside of an IF statement within a plain text email template. The template is like this: Hi {!Receiving_User.FirstName}, {!IF(Receiving_User.Profile = "Desired ...
2
votes
1answer
4k views

Show actual currency to 2 decimal places in Visual Force Email template

I have an visual force email tempalte however the currency field is giving me some problems: We are writing to advise you that an amount of £{!relatedTo.Amount__c} is outstanding ...
1
vote
2answers
93 views

Null in aggregate query

I have an image stored as a document. I put this image in an email template and reference it by doing: <img id="toplogo" src="{!LEFT($Api.Partner_Server_URL_140, FIND('.com/',$Api....
0
votes
1answer
3k views

Trying to put server name into a URL for email template

I am using a visual force template. I can put the origin server in the email by doing: {!LEFT($Api.Partner_Server_URL_140, FIND(".com/",$Api.Partner_Server_URL_140)+3)} and when I an email sent I'...
0
votes
2answers
241 views

How to find 'URL' and append something at the end of URL

In Data Extension one field 'HTML' have Data that I have shown below, Now I have to Find the 'Href', and and at the last of URL append some text like '&MC='. It may have Multiple 'Href'. Please ...
0
votes
2answers
3k views

Parse JSON string in AMPscript

We are currently passing a string attribute via the REST API that contains JSON. { "User_List": "[{\"name\":\"john doe\", \"email\":\"john.doe@mail.com\"}, {\"name\":\"jane doe\", \"email\":\"jane....
10
votes
3answers
9k views

SendEmail failed. REQUIRED_FIELD_MISSING, Missing targetObjectId with template:

Can any one help me out with this error . 1)When im using mail.setTargetObjectId(c.CustomerSignedId); the system start throwing a error . SendEmail failed. First exception on row 0; first error: ...
2
votes
4answers
905 views

Web Analytics Connector breaking custom unsubscribe page when clicked within email

We created a custom unsubscribe page for a email template that encodes subscriber information when clicked. The unsub page URL contains a ? - normally, not a problem. However, the account has web ...
1
vote
1answer
604 views

Merge Fields and Template Defaults with QuickAction.QuickActionDefaultsHandler

I am currently trying to implement a default action for the E-mail button on my Case Feed. I am using the QuickAction.QuickActionDefaultsHandler to set my default actions, using the little bit of ...
7
votes
3answers
19k views

How to send an Email Template via Apex?

Goal I'm attempting send a good looking HTML from Apex code, here's a stripped back screenshot . Based on the documentation I've reviewed, with Apex we can leverage SalesForce email templates using ...
5
votes
1answer
5k views

INVALID_ID_FIELD, WhatId is not available for sending emails to UserIds

I am trying to run below code in trigger. List<User> recipients = [SELECT id FROM User WHERE UserRoleId=:operationsRole.Id]; for (User usr:recipients) { Messaging.SingleEmailMessage ...
4
votes
3answers
19k views

Apex/Visualforce: multiline IF statement in HTML

Can I write a multiline if statement in Apex/Visualforce HTML? Something like (definitely pseudocode): <apex if (condition)> <strong>This HTML.</strong> <apex else> <...
4
votes
1answer
3k views

Email Template Replace merge field

I have an email template which uses merge fields from a custom object. For reasons difficult to explain here, I have to write my own code to read the body of the email template in Apex, replace merge ...
2
votes
1answer
851 views

Multi-lingual Visualforce email templates

I have a requirement where on workflow rules I want to send out an email in the users preferred language, Is there a way to create multi-lingual visualforce email templates? here is the sample ...
2
votes
0answers
28 views

Render based on TemplateId [duplicate]

I have a requirement to show an apex page message "XX YY" if the selected template id to email is "Update Status". (This message needs to be displayed when they make the selection not when they click ...
1
vote
3answers
1k views

Guide Template Language to provide dynamic links via href attribute

I'm trying to use the Guide Template Language to provide a dynamic link in a triggered send, something like this: <a href="{{My_Url}}">{{My Url}}</a> or <a href="{{My_Url}}">Your ...
1
vote
1answer
483 views

Mass Email Multiple Contacts from Multiple Cases

Any thoughts on a solution for mass emailing, using an email template, multiple case contacts (via contact roles or contact fields) from multiple cases? Each set of case contact role emails would be ...
1
vote
1answer
975 views

How to load images (Header and footer) in the VF Email template?

I am looking to load the header and footer images present in the Document tab When I click on the URL: https://c.cs53.content.force.com/servlet/servlet.ImageServer?id=0150j000000DHQL&oid=...
0
votes
1answer
3k views

How do I send translated emails based on the language on the user record?

Just i want to send email content type multiple language. <messaging:emailTemplate subject="Confirmation Registration" recipientType="Contact" relatedToType="User" language="{!relatedTo....
0
votes
1answer
3k views

ExactTarget - Is it possible to send template email to list of users

I am trying to build a simple email application using Javascript to go against either the ExactTarget SOAP or REST API. Our goal is to use only Exact Target to build email templates and then send ...
11
votes
4answers
4k views

Test case failures due to VF email template

First, a little background information: I'm working on an end-to-end custom quoting solution that leverages the standard Quote object. We also utilize Sterling CPQ, which serves as the end-state for ...
8
votes
1answer
1k views

How to get https link using URLFOR() in Email Template

So, I'm trying to build a link to a visualforce page in an email template and the following works... almost. The only problem is that I'm getting a non-ssl link (http:// instead of https://) <a ...
7
votes
1answer
259 views

When supplying a template parameter to EmailAuthor how can I make the email body editable?

This question concerns the native /_ui/core/email/author/EmailAuthor system. I can pass values to the form in the URL like so: p2_lkid = To field p3_lkid = Related to field template_id = ID of ...
6
votes
1answer
4k views

SingleMessage with TemplateId in Apex: need to add more recipients

I am writing code to send emails to contacts via Apex using templates. My issue is that I need to be able to copy these emails to various other users that are going to be determined at run time. This ...
6
votes
2answers
9k views

Images not showing up in Email sent using email template

I know this issue is out there and I went through most of the "image not being displayed in email" questions, but nothing is helping me so far. I am sending some images in my email. In my controller ...
6
votes
1answer
3k views

TEMPLATE_NOT_FOUND When workflow is fired from Communties

In a partner community I have a button which users click to accept a request. On the click of this button I perform an update on a record, which then causes it to meet some workflow criteria. At this ...
6
votes
1answer
1k views

Setting Font Face for Visualforce Email PDF attachments “messaging:attachment”

I'm having lots of trouble setting font faces for VF Email PDF attachments (see my code below). I've tried the conventional "font" tag with no luck, even CSS doesn't work! What am I doing wrong? <...
6
votes
2answers
3k views

How do I insert an image from a Rich Text field in an html email template

I have rich text area field with an image but when I am trying to include the field using the merge field in the html email template ...image is not displaying in email.Any ways to display image from ...
5
votes
1answer
3k views

Hyperlink in VisualForce Email Template

I'm trying to create a conditional email template that will show fields based off ticked checkboxes. In the statements, I would like to include a link in standard HTML format Sample Text but the ...
4
votes
1answer
7k views

WhatId Is Not Available For Sending Emails To UserIds [duplicate]

I am getting the error - WhatId Is Not Available For Sending Emails To UserIds while trying to send email to user from an Apex Trigger using SingleMailMessage. The code is working absolutely fine ...
4
votes
3answers
466 views

Some recipients see lines of code in e-mail template

I coded an e-mail template in Visualforce, however, some recipients see lines of code in the the e-mail that's sent to them. Please see example below: Hello , Products to be include in the quotation ...
3
votes
1answer
2k views

Approval process step field update doesn't appear in same step's Visualforce email template?

Two step approval process on custom object Foo__c initial value of Foo__c.Status__c is 'Submitted' Approval Step 1 actions are threefold: Field update on Foo__c.status__c = 'Step 1 approved' Text ...