Questions tagged [email]
Salesforce provides multiple forms of email, including email templates, mass email, email services, email alerts, and email sent via Apex.
2,808
questions
64
votes
1
answer
60k
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 ...
38
votes
3
answers
3k
views
How can I capture a system.limitexception stopping my emails being sent
In Salseforce governor limits, it states that every org is allowed to send single emails to 1000 external addresses every 24 hours. On very rare occasions, an org I work with has exceeded this limit ...
25
votes
2
answers
520
views
Email value is saved without parentheses (label) when using DML
When an email contains a label enclosed in parentheses, the value can be saved as typed in via SF UI. (Note: the email value "as is" is only seen when in Edit mode.) However, when the record is saved ...
22
votes
5
answers
40k
views
SINGLE_EMAIL_LIMIT_EXCEEDED. What does it mean?
What does the exception mean? It does not seem to be related to the Number of email invocations limit because of the following line at the end of the log: Number of Email Invocations: 5 out of 10
I ...
22
votes
2
answers
10k
views
What's the Advantage of using MassEmailMessage instead of multiple SingleEmailMessage?
I'm scoping out a project that will involve sending outbound email messages, and I'm a little confused about why one would use a MassEmailMessage instead of multiple SingleEmailMessages.
If you look ...
20
votes
2
answers
48k
views
How to Test Messaging.sendEmail
Looking for some help/advice in writing a test class. The class I need to test is an apex class to schedule a report that needs to be sent to an external email address once a month as a .csv ...
18
votes
3
answers
56k
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 ...
17
votes
8
answers
37k
views
How to create a lead from an email?
I am looking for the easiest option to create a Lead using an email. Ideally I would send an email to a predefined email address, and it would automatically create a Lead in my Salesforce.com ...
17
votes
2
answers
12k
views
Convert HTML to PDF in APEX
I am trying to convert an HTML email that is sent to an Email Service into a PDF file. Some of the options I have explored:
attachment.fileName = fileName + '.pdf';
attachment.mimeTypeSubType = '...
16
votes
4
answers
14k
views
How to test if outbound email is send
I have a batch that sends out an email notification to the triggering user when something went wrong. The code that does this is called from the finish() method.
I'm now looking for an elegant way to ...
16
votes
1
answer
486
views
Made 3500 SOQL Queries in one context. LIMITS HACK?
Steps to reproduce:
Create Visualforce Email Template
Create Visualforce component and add it into the email template
Create Apex Controller for the component from pt.2
Do some SOQL queries there, ...
15
votes
3
answers
21k
views
Trigger on Case EmailMessage
I have a customer that wants to have a field on the case updated when a user sends an email from a case. For simplicity sake, let's just say we need to put some string into a custom field each time ...
14
votes
3
answers
10k
views
Salesforce SMTP Relay with Office 365
What is the best way to send emails from salesforce so that it looks like the email has come directly from my email address and not [email protected] on behalf of...
We use office 365 for our ...
14
votes
2
answers
3k
views
Identify which OrgWideEmailAddress records are valid for current user
I'd like to create a popup list on one of my Visualforce pages, for a user to select from a list of OrgWideEmailAddress records. My goal is to limit the list to only those records that they're ...
13
votes
5
answers
2k
views
How to send an email in response to a triggered event?
We need to send emails in response to a triggered event. We have created two data extension, one for client data and another to event data. These data extensions are filled with API procedures.
We ...
12
votes
4
answers
4k
views
How can you avoid hitting 24-hour limits on emails and future calls?
I realize there are plenty of ways to try to avoid hitting limits in the first place, but when it comes to features with 24 hour limit plans, how can you know if you're getting close to them? And ...
12
votes
1
answer
1k
views
Not receiving all Apex Exception emails for Managed Package
We have a Managed Package deployed on several dozen orgs, and appear to be missing a lot of Apex Exception emails.
We do receive a number of such emails on a regular basis (so we know it's working ...
11
votes
3
answers
17k
views
SingleEmailMessage - send email to a recipient different from the record referenced by setTargetObjectId
My code is as follows:
List<Messaging.SingleEmailMessage> emails = new List<Messaging.SingleEmailMessage>();
Messaging.SingleEmailMessage email = new Messaging.SingleEmailMessage ();
...
11
votes
3
answers
7k
views
Is it possible to get a sharing link (to non SFDC users) from 'files'/'content' via apex?
A bit of background: I have a client that I built a custom model library for, and in this page they can select a group of models and email them (say instructions to the next gig or notify them of ...
11
votes
5
answers
13k
views
How to override the "Send an Email" button on the Case object - Emails related list
On the Case object page, there is an Emails related list which has a Send an Email button taking the user to another page to fill in the email.
I haven't been able to find a way to override the ...
11
votes
1
answer
4k
views
Accessing Email logs using REST or SOQL
For Email Logs, we follow below steps generally:
Go to Setup--> Logs --> Email Log Files --> Request an Email Logs --> Download(once it is ready).
Is there any way to access this information ...
11
votes
1
answer
763
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
1
answer
12k
views
Send test email from sandbox
I'm very new to Salesforce. However, I was asked to make some changes to an approval process. This has email sent at certain times during the process. I have a process change made that I want to test,...
10
votes
3
answers
22k
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
3
answers
6k
views
Optimal way to get Case.Id from Case.Thread_Id
We've implemented a custom Apex Email Service to extend the standard Email-to-Case functionality, and one area we're struggling to do efficiently is figure out the CaseId when all that is known is the ...
10
votes
1
answer
7k
views
How to create an EmailMessage record with DML having HasAttachment to be 'true'?
I'm creating EmailMessage records via DML
EmailMessage createWhatEmail = new EmailMessage(
Subject = 'test'
,Status = '3'
,ToAddress = 'heim@...
10
votes
4
answers
15k
views
Messaging.sendEmail fails with TargetObjectId, WhatId, and SaveAsActivity
I'm trying to send email from Apex using a VF Email Template. The <messaging:emailTemplate> tag in the template specifies recipientType='contact' relatedToType='MyCustomObj__c'.
I'm using code ...
10
votes
2
answers
13k
views
Organization-wide email address - Use unverified email in sandbox
I have created a workflow email alert to be sent from an organization wide email address which is verified only in the prod org.
I now need to create the same in dev sandbox and commit to git (We use ...
10
votes
3
answers
5k
views
Marketing cloud extend <a> tag to space or punctuation after tag is closed in emails
I'm having a consistent problem with emails sent via Marketing Cloud. We use the classic content builder and HTML paste for newsletters. We have a problem where some links get extended to include the ...
10
votes
1
answer
2k
views
Do not send email when activating a user
I'm writing some code that should (de-)activate some users based on some criteria. This part was easy, but one of the requirements is also that this user should NOT get an email.
So when I create a ...
9
votes
2
answers
11k
views
Case Assignment Rules - Assign to Queue and Email Members - no email sent (Insert by Apex)
Goal:
When a case matches criteria is created assign the Case Owner to "Research Queue" and e-mail queue members.
Current setup:
Queue created for Cases, no distribution email listed (Just Members)
...
9
votes
3
answers
5k
views
To Check if Org-wide email is verified in APEX
I have created a picklist with selectOptions as Org-wide email address as below
VF Code
<apex:selectList value="{!emailFromAddress}" size="1" multiselect="false">
<apex:...
9
votes
2
answers
3k
views
Updating Contact Email from User Email Update
Is there anyway I can update a contact email when the user's email is updated?
I though this can be done via User trigger easily, but the problem is whenever the email gets updated from the User page,...
9
votes
2
answers
11k
views
Send an email with apex with visualforce as email body
I have a visualforce page that I am trying to send from Apex code. I can't use a template for the e-mail and this visualforce page is never actually visited by anyone. I don't want the page to be ...
9
votes
2
answers
2k
views
Sending HTML emails with inline images via SingleEmailMessage
I have a requirement to send inline images in HTML email using SingleEmailMessage.
I seem to be stopped by an unresolvable problem caused by a gap in the Salesforce API.
Inline images require me to ...
9
votes
2
answers
2k
views
Salesforce new IP addresses issue
So about a month or so ago, Salesforce released a new list of IP addresses that needed to be whitelisted. See the knowledge article below for a full list of the IP addresses
https://help.salesforce....
9
votes
0
answers
2k
views
Update user email without email confirmation via Apex
I have been trying to update the user email via scheduled apex, but it seems I am out of luck!
User u = [Select Id, email from user where email = 'emai[email protected]' limit 1];
u.isactive = ...
9
votes
0
answers
2k
views
Email Deliverability - how to change it programatically?
In all new sandboxes "Email Deliverability" is set to "System Email Only". I am writing a SandboxPostCopy class to run for all new sandboxes, and want to use that class to change deliverability to "...
9
votes
1
answer
185
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 ...
9
votes
2
answers
2k
views
Salesforce with Lync Collaboration (automate meeting request generation & email)
I am evaluating the possibilities of integrating Lync with Salesforce. Ideally the requirement is to engage the customer over a video chat. The Agent from the Service Console will click on a Button, ...
8
votes
3
answers
5k
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
1
answer
6k
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 ...
8
votes
1
answer
1k
views
Detect if Compliance BCC Email is enabled
Problem:
If the Compliance BCC Email setting is enabled email messages cannot be sent with custom BCC addresses e.g.
Messaging.SingleEmailMessage toSend = new Messaging.SingleEmailMessage();
toSend....
8
votes
1
answer
376
views
Emails Per Invocation Still Capped at 100?
I was recently trying to answer a question about email limits. I remember there being a cap on the number of emails sent per invocation (100), but I couldn't find any documentation that still mentions ...
8
votes
3
answers
15k
views
Is it possible to send an email via the REST API?
I'm looking to send emails through the REST API, specifically through Restforce in Ruby, but I can't find any resources on this. I am finding my resources about the sendEmail function, and how to set ...
8
votes
5
answers
1k
views
Send mass email through Salesforce
What is a good option for sending 200.000+ emails a month over Salesforce? Ideally we want to use an emailer like Amazon SES or SendGrid. The problem is that reading their API you are forced to do 1 ...
8
votes
3
answers
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:[email protected].
From the official documentation I learned to use an unsecured SMTP server to do ...
8
votes
4
answers
732
views
Mismatch in Links recieved through email alerts and User getting redirected to home page
We have a case where our users create tasks. When they create tasks, they also check the "Send Email Notification" checkbox present on the task. As a result the owner of the task, receives an email ...
8
votes
2
answers
3k
views
Does Messaging.SendEmail() not work in a Platform Event trigger context?
I can't figure out why an email isn't being sent. I've got a Platform Event trigger which ultimately is supposed to send an email. Most of the code isn't directly relevant, but here's the surrounding ...
8
votes
2
answers
2k
views
Sending an email from a trigger with an addError
We have the requirement that if a Case is created via email2case and the Account has a flag (SecureSupport__c) checked then we should block the case creation and send a notification to the contact ...