Questions tagged [singleemailmessage]
Relates to the SingleEmailMessage class, which provides methods for sending single email messages through apex.
323
questions
0
votes
1
answer
19
views
Not able to send email using Messaging.sendEmail if I am Community Guest User
Requirement: Take input (Name, Phone) from user into LWC modal and on click of submit button fire email, using Apex Messaging class, if user is Community Guest User.
Current Issue: When logged in as ...
-1
votes
0
answers
17
views
Cannot receive email when we send email as force.com site user
I've a lightning out app, and added this app in salesforce "Force.com Sites".
I'm not receiving any emails as I'm supposed to receive based on some action in the lwc app placed in lightning ...
0
votes
1
answer
31
views
OrgWideEmailAddress and Messaging.SingleEmailMessage test class coverage
I have a class where I'm sending the email. My test class passing successfully but not covering Messaging.SingleEmailMessage and OrgWideEmailAddress. What I'm doing wrong here?
public without ...
-1
votes
0
answers
24
views
Email not getting send when SaveAsActivity is true -- "Customer Community" License User
We recently brought "Customer Community" License User. We are creating a case from custom component. Once the case get created, I want to send an email to Contact from apex trigger. I got an ...
0
votes
1
answer
43
views
Custom Font for email [duplicate]
I need to insert this Google Font (font-family: 'Solway', serif;) and use it for my email. I've already tried the @import and functions that Google Font suggest to use to upload the font but it will ...
3
votes
0
answers
117
views
How to send Case Emails to Users via Apex
Note: this question has been significantly edited after I discovered a new, more immediate issue with this scenario.
My use case:
A Case may be created via Internal User, Community User, or Email-to-...
-1
votes
1
answer
37
views
Getting error(TestMethod do not support Web service callouts) test class is failing because of the existing trigger on Job__c which making callouts
Not able to cover only Email messaging part in Execute method in batch class coverage is 62%
Any help will be aprreciated.
Batch class-
global class SendEmailJobsAlertBatch implements Database....
0
votes
1
answer
68
views
Apex code to get Tasks and send email to task owner
I want to send email to user about his open tasks. Each user will have more than one task.
I have a set of taskIds and querying all tasks based on these IDs.
How do I get email address of task owners ...
0
votes
0
answers
25
views
Two objects in email template [duplicate]
I have a simple email template
{!Job_Applicant__c.FirstLast__c},
Please use the link to see my available times and select one that works for you: {!User.Calendar__c}
I look forward to ...
0
votes
1
answer
61
views
Batch class finish method email exceeded
I am trying to send the email with csv file attachment but it returns email limit is exceeded error, so I tried to send email using trigger there it work properly than why it is not working with batch ...
0
votes
0
answers
60
views
Can we track email message status for emails sent from Apex sendemail methods on Case object
When we send emails through Batch apex programmatically using Messaging.SingleEmailMessage send email method with parent/targetobject as Case, for some reason we cant see the email status changing to &...
1
vote
1
answer
85
views
How to send Translated email body using Custom Label and Messaging SingleEmailMessage
I created a Custom Label and added translation for Spanish. I am calling this Custom Label in the Email Subject Body. How can I implement the translated email depending upon User LanguageLocaleKey?
...
0
votes
2
answers
55
views
Cannot receive more than 50 SingleEmailMessage
I use the following code to send 100 emails to one user, but received only 50 emails.
for(Integer i = 1; i < 100; i++) {
Messaging.SingleEmailMessage newMessage = new Messaging....
0
votes
1
answer
141
views
Send email using guest user
I have created an LWC with a form to create a Lead and placed it on the community site which is public. Now when a Lead is created there's a trigger that is supposed to run and send an email to the ...
0
votes
1
answer
93
views
What exact parameter should I pass in setReferences() method from Messaging.SingleEmailMessage Class
Scenario:
The requirement is to send mail through apex but the tricky part is to identify the old email email chain (that once started from Salesforce then received by the receiver then the receiver ...
0
votes
0
answers
27
views
Covering for loops in test class that sends an email
I can't seem to figure out how to cover the portion of the class within the for loops. I'm not sure if there are additional things to add since it's sending an email.
public with sharing class ...
1
vote
0
answers
136
views
How can I bulkify EmailMessage insert when sending mass SingleEmailMessage
I am having an issue with bulk sending bulk emails, that then insert as emailmessage, even if I do a bulk send of emails when it goes to insert the emailmessage it is doing a single insert for each ...
0
votes
1
answer
108
views
Messaging.SingleEmailMessage does not produce any errors but email is not sent
I have seen a ton of posts regarding this issue where we cant set an user as targetObjectId and an object as WhatId when we are using an Email Template. Then I came across some posts using Messaging....
0
votes
0
answers
39
views
Set Default From Address to Do-Not-Reply email address
I have set OWD's email address as Do-Not-Reply@company.com. My requirement is when the user sends an email from an Email Message the default From should be set to Default DoNotReply address but it is ...
0
votes
1
answer
131
views
When file is uploaded need to send an email with attachment with file format
I have a task that when i upload a file with excel or pdf or any format at that time it have to send an email with attachment with the file type which i upload .
Below is my code:-
trigger ...
1
vote
1
answer
617
views
sending html email from APEX using templates
When I am doing a test send using the data in the quote object record, I am getting an html formatted email with values.
In the doc: https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/...
0
votes
0
answers
19
views
How to retrieve second set of email invocations in unit test? [duplicate]
I'm triggering an apex email in my unit test. I would like to assert that 1 email has been invoked. I can see from the logs that it is invoked. However, it seems that my code is looking at the wrong ...
0
votes
1
answer
89
views
Single email messaging class functions [closed]
Is there any good resource where its explained clearly about the below functions of Single Email Messaging class and their usage:
renderStoredEmailTemplate
setWhatId
setTargetObjectId
setTemplateId
...
0
votes
0
answers
125
views
HTML Visualforce Email Template for custom object lookup fields
I have a custom object called Class__c and Contact(Participant__c) is lookup field.
I have set up an email alert every time a class button is clicked. But I'm unable to show the a lookup field value ...
0
votes
1
answer
36
views
How to send financial force sales invoice with attachment [closed]
I've been trying to send the financial force email that from Apex that is called from a Process. As I understand the invoice should be attached when the email template is used with the WhatID set (...
0
votes
0
answers
27
views
How can I send a file (pdf or word) from a library as an email attachment automatically?
I have tried to use the EmailAuthor URL hack by appending doc_id= as one of the parameters, but it loads the EmailAuthor page with all the details except the attachment.
I tried with doc_id=...
0
votes
0
answers
20
views
Send emails through apex - synchronous
I have a lightning component quick action on Opportunity that sending emails to Offer__r.Contact where Offer__r is a related list of Offers on the Opportunity.
I have a need to update a counter fields ...
0
votes
1
answer
35
views
(How) can I create an email template which digests multiple instances of an SObject?
Let's say I have a custom SObject MyObject__c with a custom text field Message__c.
Periodically, I want to send out an email which will collect all instances of MyObject__c which have the same value ...
0
votes
1
answer
39
views
VisualForce Email Template - Error: Syntax error If Condition
Getting Error: Syntax error when i tried to add the below condition in Visual-force Email Template
with dynamic variable
{!IF(recipient.RecordType.Name != 'Guardian',{!relatedTo.Name__c}, {!relatedTo....
0
votes
1
answer
349
views
Replacing text in lightning email template from apex
I have an Email template which looks like that :
-----------------------
Name : {ContactName}
Account : {AccountName}
{price} : {Cost}
Date: {MinDate}
-------------
I'm using the email template to ...
0
votes
0
answers
29
views
Restrict user deactivation if Account is owned by the user and send an Email with details
please help.
I am new to SFDC please help.
Requirement: Restrict user deactivation if Account is owned by the user and send an Email with details.
Trigger on user object:
trigger userTrigger on ...
0
votes
0
answers
22
views
How to convert an incoming email HTML body into a Content Document?
I have a use case where the HTML body of an incoming case email is needed as reference on several different objects.
It would be easiest to just convert the email body to a Content Document, but how ...
0
votes
0
answers
35
views
rendered not working in vf email template
I am trying to dynamic render vf component inside a vf template using rendered attribute. But i am not getting any values and i am receiving a blank email.
Here i am trying to send email with ...
0
votes
1
answer
63
views
Webservice callout in Apex component used in EmailTemplate thrws Programmer Error: transaction committed or rolled back while performing api operation
I have an email template which I need to build using many information , so I have used apex component
<c:EmailTemplateComp ObjectID="{!relatedTo.Id}" show_url="false"></c:...
0
votes
1
answer
387
views
Flow Variable of Email addresses to Invocable Apex action
I'm trying to pass in the flow variable collection of Email addresses to Apex action to send out one email to each email address. I got some idea from Question, the code works fine when i ran it from ...
0
votes
1
answer
577
views
Multiple Emails via Apex Batch instead of one
We have a Batch Apex that loops over 9 Custom objects and sends out one email to each user who are assigned in any one of the custom object. This should send out one email to each even though if they ...
4
votes
1
answer
145
views
Emails are not being received when sent through Apex
Below is my sendEmail Method .
public void sendMail(List<user> Users, string emailTemplateName) {
final string FROM_ADDRESS ='Test';
List<Messaging.SingleEmailMessage> emails = new ...
0
votes
1
answer
89
views
Email is displaying user who deactivated account info rather than the user record that is being deactivated
I am sending email to single email address, when users are deactivated through apex. Below is my send email method
public void sendMail(List<user> Users, string emailTemplateName, string address)...
1
vote
1
answer
152
views
Apex Email CPU Limit
I am facing Too many SOQL Error.
Reason: Using "renderStoredEmailTemplate" method inside for loop that counts against SOQL query for every iteration.
global class FlowInput {
@...
0
votes
1
answer
223
views
How to update EmailMessage(activity history) associated with a lead
In continuation with this question:
Background:
I send a SingleApexMessage from apex code and want to associate it with a Lead so that a record of Activity History is created when this email is sent. ...
2
votes
1
answer
117
views
how to get correct FileExtension for word document from ContentVersion received in mail attachment for pdf its correct but for its not .docx for word
Hi I am getting wrong extension or type for word document from ContentVersion in mail attachment for pdf its coming correct but for its not .docx for word I debug its coming WORD_X which is wrong and ...
0
votes
0
answers
77
views
How can I get template body [text] in apex class?
Here is my code below:
List<Messaging.SingleEmailMessage> allmsg = new List<Messaging.SingleEmailMessage>();
Messaging.SingleEmailMessage mail = new Messaging.SingleEmailMessage();
...
2
votes
1
answer
828
views
Messaging.sendEmail not sending emails for non-admin profile in sandbox
In a partial sandbox I am calling Messaging.sendEmail through an @InvocableMethod through a Flow, and emails are not going out for a non-admin profile. There are no errors anywhere and even debugging ...
1
vote
0
answers
30
views
How to show "From Name" in Email Template
I want to show specific From Name in the email template as I have more than one record in the Org wide address. Can anyone help how to do it?
Note : I am always getting the current logged in user name ...
0
votes
1
answer
238
views
Apex Class Not Sending SingleEmailMessages [closed]
To begin, I'd like to explain that the following class works in tandem with a process that detects incoming email messages to a case and then sends the ID of that email message to the class.
The class ...
-3
votes
1
answer
35
views
NOT able to Save either VFP or APEX class [closed]
MY VFP:::
<apex:page controller="EmailControllerClass">
<p>
compose Email:::
</p>
<apex:form>
<apex:outputLabel value="...
0
votes
0
answers
99
views
How to change "from" address of email received via Email services
I am using Email services to catch the emails sent to Salesforce Email address configured in Email service. As we know, email address can not be set up as a custom address and has to be in a format ...
0
votes
1
answer
69
views
Scheduled Apex Class Not Executing in Test Class [duplicate]
Hey guys so I’m having trouble with testing my scheduled apex class that is sending an email. The problem that is occurring for me is that when I click test, my System.assertEquals are not true ...
0
votes
0
answers
42
views
From Field blank while sending email from record
One of my users is trying to send an email from a record page. but while sending the email from is blank and it's grayed out.
The user is not able to send any email because of this.
I know by adding ...
0
votes
1
answer
141
views
What types of e-mails are counted against the daily SingleEmailMessage Limit?
I tried googling but couldn’t find a clear answer to what all emails that are sent from Salesforce count against the SingleEmailLimit of 5000 per day. Does workflow rule e-mail alerts count against ...