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
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 ...
35
votes
6answers
19k 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. ...
23
votes
6answers
22k 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 ...
17
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 ...
13
votes
3answers
12k views

How to determine where an email template is being used?

We have some email templates in our email templates folder, but I'm not sure where they are being accessed or used. How do I investigate this? I looked into the emailTemplate table, but it didn't ...
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?
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 ...
11
votes
2answers
6k views

Communities Welcome Email - Set Password link not working ({!Community_URL})

Background: We've enabled communities and set up user profiles, access etc. There are no login flows nor SSO going on, everything is pretty standard apart from a custom login page (active site ...
11
votes
1answer
637 views

JS Synchronous Calls - Email with Attachment

I'm trying to set up a JS button on a SFDC object record that sends an email to a recipient with a specific attachment from the Notes and Attachment related object. Would I theoretically be able to ...
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: ...
10
votes
3answers
9k views

Visualforce HTML Email Template - Ability to Edit Text in Preview Before Sending

I've created a Visualforce HTML Email Template with multiple language translations that is associated with a Case. When selecting the template, the customer service rep will occasionally need to ...
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 ...
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 ...
8
votes
3answers
6k views

How to do email relaying in a safe way?

We want to use email relaying for our outgoing mails, to avoid email spoofing - aka sent via:1235434...@salesforce.com. From the official documentation I learned to use an unsecured SMTP server to do ...
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="...
8
votes
0answers
243 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 ...
8
votes
1answer
149 views

How can I reproduce the EmailAuthor native SFDC application?

I'm comfortable with sending emails using APEX and using mailmerge within that process. What I want to do now is load an email template, mailmerge it automatically using a predetermined contact ID and ...
7
votes
1answer
1k views

Send bulk financial force emails

I am trying to automate the sending of sales invoices generated through financial force. I would like a one click process which fetches the outstanding invoices, bulk emails them and then marks them ...
7
votes
3answers
2k views

Can you perform DML operations from visualforce email templates?

Visualforce email templates allow you to include visualforce components with allowDML="true" but there doesn't appear to be any way to actually use DML. From the docs: You can't use data ...
7
votes
3answers
20k 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 ...
7
votes
1answer
261 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
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 > ...
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
6k views

Access related object via lookup field in email template

I have one object called Service Request, them I have a lookup field of Account with retrieves me the name. In my email template I must show up: Account: _______ & Account Code:______ My ...
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
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
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 ...
6
votes
2answers
4k views

VisualForce page to allow inline editing of EmailTemplate HTML

Thanks for taking a look at my problem. I am building a VisualForce page to email all CampaignMembers associated with a Campaign record. Everything is working except for one little thing: I have an ...
6
votes
2answers
3k views

Email Template related record not available

I'm building an email template, and I want to use merge fields from either a Lead or Contact but I also want to use a related record. I copy the desired merge fields into my template in the web-ui ...
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
1answer
2k views

Can you embed (not link) an image in an email template?

Is there any way to actually embed (not link to) an image in an email template in salesforce? What I have in mind would create an email with a 'Content-Type: text/html; charset="us-ascii"' in which it ...
6
votes
2answers
889 views

How to send an email before delete record using Email Template

I would like to send an email by using email template before delete a specific record. I'm using a before delete trigger and I receive the email, the problem is that the email is almost empty, without ...
5
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> <...
5
votes
2answers
3k views

Salesforce Lightning Limitations Winter '17

Salesforce Lightning Limitations in Winter '17? I have looked up and down and cannot find if (or when) Email Templates from Classic org are avaliable in the Winter '17 release of Lightning. i found ...
5
votes
2answers
237 views

how to build a template based on the user record

I am trying to create a template that reports on the user record details. However I run into an issue when I create an email alert form a workflow that is triggered when a new user record is created. ...
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 ...
5
votes
2answers
2k views

How to generate letters in salesforce

how to generate letters in salesforce from templates, and then to print via some button (print button). I am in confusion about this. As I am confused in merge mail and generating letters. Thanks in ...
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 ...
5
votes
2answers
3k views

Update Salesforce Community Url to custom login page

I have below default welcome email template which redirects the users to standard login page but it doesn't goes to my new custom community login page. Hi {!Receiving_User.FirstName}, Welcome to {!...
5
votes
1answer
2k views

Sort Related list on visualforce email template

I have a visualforce email that show all case comments within a case. I'd like to sort the comments by created date (which is one of the columns). How can I achieve that? <messaging:...
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"> <...
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 ...
5
votes
1answer
1k views

Output of VisualForce Component inside VisualForce Email Template Gets HTML Encoded

I have a Visual Force component inside a Visual Force Email Template with the intention of producing an HTML email in which the component is reponsible for rendering some of the HTML. What seems to be ...
5
votes
2answers
2k views

Single Click reply to Approval Emails

Currently, to approve any salesforce record through email, you have to reply to approval email using Approved/Yes and it gets approve. I just want to skip the step of writing "Approved/Yes" for ...
5
votes
1answer
211 views

Self-Registration Alert Administrator Email Template

I created a trigger to make new self reg users inActive after registering. Then created a workflow to email the Admin when a user self registered and to verify and activate that user. In my email ...
5
votes
1answer
367 views

Individual Email Results Issue (same JobID different BatchID)

we are having a problem with Individual email results. Our aim is to show individual email results in Salesforce after sending emails from a journey configured in Marketing Cloud. We sent several ...
5
votes
1answer
5k views

Email template merge fields not populating when sent via Apex

I'm having trouble with email template merge fields that are not being populated when the email is sent by Apex. I have an Apex method that uses setTemplateId, setWhatId, and SetTargetObjectId. The ...
5
votes
1answer
370 views

Can we specify “without sharing” in Visualforce email templates?

We have a workflow rule that triggers when ownership of a record changes and certain conditions are met-- part of the criteria is ISCHANGED(OwnerId), which causes the workflow to perform its actions. ...
5
votes
1answer
2k views

How to add line break in richtextarea field

I have a requirement to implement a user email signature in visualforce email template,and i have tried this code {!$User.Email_Signature_Rich__c} it's appering without line breaks in signature.How to ...
5
votes
1answer
4k views

Print AMPscript Variable inside HTML <tag> as attributes

So I am using ExactTarget templates and content areas to build my emails. In my templates I have AMPscript variables defined in the < head > and that will determine how elements in my content areas ...