Questions tagged [singleemailmessage]

Relates to the SingleEmailMessage class, which provides methods for sending single email messages through apex.

Filter by
Sorted by
Tagged with
0 votes
0 answers
83 views

Apex error SendEmail failed. First exception on row 0; first error: UNKNOWN_EXCEPTION, null

On Wednesday 10/4/23 about 2pm EDT, I suddenly started getting runtime errors from salesforce: SendEmail failed. First exception on row 0; first error: UNKNOWN_EXCEPTION, null only when the logged ...
Michael Robert's user avatar
-1 votes
1 answer
135 views

Salesforce limits on sending email in one hour

One of the user send an important email from an opportunity record to the team members. We can see the email message record in the related list but non of the team members received the email. I want ...
shwarma g's user avatar
0 votes
1 answer
41 views

Not able to add list<String> BCC to setBccAddresses ,VARIABLE_ASSIGNMENT [885 line] common.apex.runtime.impl.ScalarList@3fc50cb5

FYI .........If I remove this BCC code emails are going fine. enter code here public static List<Messaging.SingleEmailMessage> listEmailMessage = new List<Messaging....
shashank kulshreshtha's user avatar
1 vote
1 answer
52 views

Troubleshoot Test Class for Schedulable Apex with Email Message

My schedulable apex is working properly and I have 100% test coverage on it, but the test is not giving me the System Assert I am expecting and I'm hoping someone can spot the reason why. The Apex ...
Kendra Broom's user avatar
0 votes
1 answer
56 views

Apex Batch stops after 2000 records

We have an Apex batch class which processes 2950 records of contacts, sending them emails with Messaging.SingleEmailMessage method(The query has a filter for IsEmailBounced = FALSE AND Email != NULL). ...
DavidS's user avatar
  • 37
0 votes
0 answers
39 views

Email is not getting sent from apex Class if I am using with sharing

I am using invokable apex class for sending email to users when my batch starts and completes, but if I am using with sharing keyword the email is not getting sent although it is showing success in ...
Ajit Patel's user avatar
1 vote
0 answers
92 views

SendEmail failed.[...] first error: INSUFFICIENT_ACCESS_ON_CROSS_REFERENCE_ENTITY when Messaging.sendEmail via guest user on a site

We have a public site which uses a guest user to execute the logic of all its aura components/classes... We are facing an issue when this guest user tries to send an email through Messaging.sendEmail(...
Arnau LS's user avatar
1 vote
0 answers
202 views

Attachments sent from Apex are not stored in the EmailMessage record or the parent Case record

I'm using `<lightning-file-upload label="Attach files" name="fileUploader" accept={acceptedFormats} ...
User2529's user avatar
  • 701
0 votes
0 answers
60 views

Email Opt out field on Contact - usage

We have the Email opt out field on Contact, lead, Person account I am trying to find a documentation that specifically mentions the usage or this field. With individual object, we can control finer ...
SEuser's user avatar
  • 1,835
0 votes
2 answers
392 views

Make merge fields work inside the email template in for loops

I have a requirement where I am sending email via batch class. I have created an email template and I want to send data to the merge fields of the template from the code that I am writing. Since the ...
Rivu Indra's user avatar
0 votes
0 answers
183 views

i write the test class for sending email with attachment class

@AuraEnabled public static void sendEmail(Id recordId) { System.debug('sendEmail is called'); // get the record data Invoice__c invoice = [Select Id,Name,Customer__r.Email__c,...
Deena Vicky's user avatar
0 votes
0 answers
79 views

Why it's necessary to put setSaveAsActivity false while the targetobjectId is user id

We are trying to send emails to community members from apex. In the current implementation, the setTargetObjectId is contactId. But it's counting towards the daily limit of single email messages. We ...
anoopijt's user avatar
0 votes
0 answers
76 views

Send Health Check report results through email

I have a use case where I need to send the details of Health Check results through email by an automation. I tried using SecurityHealthCheckRisks object to retrieve data and send it through ...
sourav guha's user avatar
1 vote
1 answer
73 views

Giving condition to avoid error SINGLE_EMAIL_LIMIT_EXCEEDED, Email limit exceeded.:

I want to give the condition if already hit the email limitation in Salesforce then the email is not sent. because right now I got the error First exception on row 0; first error: ...
Mustika Farma's user avatar
0 votes
1 answer
2k views

sending bulk emails using sendEmail action in flow

I have been lately exploring on how to send bulk emails from flow. There is documented way to send single email using singleEmail action as described here. I implemented this and new I can ...
AmanSharma's user avatar
-2 votes
1 answer
154 views

Email SendTo addresses using custom Label is showing invalid email error [closed]

Following code showing error : EXCEPTION_THROWN [105]|System.EmailException: SendEmail failed. First exception on row 0; first error: INVALID_EMAIL_ADDRESS, Email address is invalid: List<...
Mona's user avatar
  • 3
-3 votes
1 answer
678 views

How to get success count and error count in batch apex [closed]

public void finish(Database.BatchableContext bc){ AsyncApexJob a [Select Id, Status, ExtendedStatus, NumberOfErrors, JobItems Processed, TotalJobItems, CreatedBy.Emailfrom AsyncApexJob where Id =:bc....
Guest's user avatar
  • 3
0 votes
0 answers
79 views

Do email alerts sent from a Flow in a managed package count against Single Email Daily limit?

One of my customers wants to build a managed package that will be sending a lot of emails to Contacts on Subscriber Orgs using Email Alerts in Flows. Will these emails count against the Single Email ...
Stanislav Shcherbakov's user avatar
-1 votes
1 answer
43 views

Not able to send invoice to the donors email?

I have a below apex class and trigger for sending invoices to donors. But in sandbox, it's working fine but in production, I am getting the below error. SendEmail failed. First exception on row 0; ...
Mr.shahi's user avatar
0 votes
0 answers
212 views

Render Visualforce Email Template into LWC?

I have screenflow that will displaying email template editor and this editor created with LWC component like this following image, and I get the body from the classic email template which use ...
naticap's user avatar
  • 121
0 votes
0 answers
206 views

apex email to case image not showing in Description field(RichText)

I have the following code to create Email-to-Case using Apex. The issue I am having is when an image is sent in the email body I am getting a broken image. can someone point me what is the mistake ...
Tamil's user avatar
  • 714
0 votes
0 answers
93 views

go around with NO_SINGLE_MAIL_PERMISSION in managed package

We have Schedulable Apex class inside Managed Package which sends us emails (using Messaging.SingleEmailMessage) about our package performance. Short code example : global without sharing class ...
Vitalii Dehnerys's user avatar
-1 votes
1 answer
95 views

Where is the From address set for this batch class?

Our site has a scheduled batch job to send a templated mailing. It uses one of our Org Wide Addresses as the From. Please notice that the existing code does not have a setOrgWideEmailAddressId() ...
Foo Bar's user avatar
  • 286
-1 votes
1 answer
62 views

Schedulable single email apex class low coverage when deployed to production

I have a schedulable email apex class that sends email to sales rep with opportunities with awaiting approval as stage. This partial apex class below is 100% covered in production, however when I ...
Jayson's user avatar
  • 3
0 votes
1 answer
1k views

Salesforce Emails Limits

I am using both Apex and Flow( each for different scenario) to send acknowledgement emails to customers on case creation. From Apex I am using Messaging.SingleEmailMessage to send emails. From flow I ...
Abhinav Thakur's user avatar
1 vote
1 answer
66 views

Custom log for outbound email apex

I'm writing a somewhat generic class for my organization. The goal is to allow to send email using apex with a one line call. This is working nice but I would like to offer some logs when we have a ...
Julien Souchi's user avatar
0 votes
1 answer
195 views

How can I get the contacts for which the email has been successfully sent in batch?

Below is my batch which sends emails to contacts based on the accounts passed in the scope. I want to mark the date on the Account on which the email has been sent to its contacts. Is there any way I ...
Deepanshu Rajta's user avatar
-4 votes
1 answer
728 views

Help with writing test class for SingleEmailMessage

I am struggle with writing test class for SingleEmailMessage. I have only 33% of coverage, and only 18/53 lines are coveraged. I used the For loop in my EmailClass, and everything after for (Case cs : ...
ApexNewbie's user avatar
0 votes
1 answer
307 views

How to break the line in Formula for a flow

I want to use this formula with merge fields in Send Email action by using the formula in the body of the email. However, I am not able to line break the text in formula. Attached are the screenshots. ...
Grace's user avatar
  • 5
1 vote
0 answers
353 views

Filling custom fields when sending emails

Although custom fields can be added to the standard EmailMessage object, there does not seem to be any way to populate these fields when sending an Email using the Messaging.SingleEmailMessage class. ...
John Lewis's user avatar
-1 votes
1 answer
220 views

SingleEmailMessage - Test class - small coverage [duplicate]

I wrote the EmailClass, and it works perfect, but I have a problem with Test Class. The coverage is only 27%. The Messaging.SingleEmailMessage and everything under it is not coverage. Could you please ...
ApexNewbie's user avatar
1 vote
1 answer
657 views

Send email and update field via Apex

I have apex class which is sending email and it works perfect, but together with email I want to change Case status and update a custom field. Inside for loop it works, but I don't want to exceed ...
NewToApex's user avatar
1 vote
1 answer
265 views

Send Email to list of Contacts in Cases

I have a problem writing an Apex class which will send the emails to the list of Cases based on specified criteria from scheduled flow. Here is my code: public class EmailClass { @InvocableMethod ...
NewToApex's user avatar
0 votes
2 answers
2k views

Send Email after Account is created - Apex

Create a trigger to create a task when account is created, associate the created task to the account and send a email to notify the owner that account and task has been created. Below is the code but ...
Deeksha Gaur's user avatar
0 votes
1 answer
310 views

VF component email template to send list of opportunities against each owner. The templates loads the only last value of list

//VF Component <apex:repeat value="{!oppUserList}" var="opp"> <tr> <td> {!opp.Name} </td> </...
SAK's user avatar
  • 15
1 vote
1 answer
445 views

How much daily email can be sent using a scratch org?

How much daily email can be sent using a scratch org? Is it governed by number of messages, number of recipients, or something else?
Alex Edelstein's user avatar
0 votes
0 answers
162 views

Apex code to trigger email is not sending Email from Einstein bot

I'm calling an apex from Einstein bot to send an Email. The apex code is running fine and its returning success = True but I'm not receiving Email on the recipient side. I have checked access of apex ...
Vishal's user avatar
  • 1
-1 votes
1 answer
434 views

How can I send an email with a salesforce report attached?

I'm try to scheduler email send with a repor attached, but when i received the email, appear the next error in the file: I'm use the nex Apex code: global class Exporter implements System.Schedulable ...
Michelle Soto's user avatar
-1 votes
1 answer
487 views

SingleEmailMessage InReplyTo Method does not append the selected EmailMessage

I would like to reply to a specific EmailMessage using Apex. According to the SingleEmailMessage Documentation, I need to use InReplyTo method. I already added the MessageIdentifier as the parameter. ...
user2018's user avatar
  • 341
0 votes
0 answers
886 views

Send email with file attachment in aura component

I have an aura component and I want to send email with attachment. The files gets added to the record but it doesn't gets attached to the email. The email is send without any attachment. Component: &...
shwarma g's user avatar
0 votes
1 answer
1k views

Sending Email from Guest User Profile- Email No Receiving Email

I have created an LWC with a form by collecting the basic info, Then i will be sending the info to the email service. Below is the code string emailAddress = GetEmailServiceAddressUtility....
user3214361's user avatar
-1 votes
1 answer
134 views

How Salesforce manage attachment while sending an email from record detail page under activity? [closed]

I am curious to know, how Salesforce manage attachments which we add while sending an email from activity. Does Salesforce stores those files somewhere in hidden objects and use them once we click on ...
Rajneesh R's user avatar
-4 votes
1 answer
123 views

System.LimitException: Too many Email Invocations: 11 - Line: 63, Column: 1

Could Not find proper solution for this Fatal Error. I have to send single single mail project wise. global class CollectionDefaulterEmail2 implements Schedulable { global void execute(...
apz's user avatar
  • 5
0 votes
3 answers
3k 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 ...
Aastha 's user avatar
3 votes
0 answers
2k 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-...
Jason Clark's user avatar
  • 11.8k
-1 votes
1 answer
50 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....
CHARUSHILA PATIL's user avatar
0 votes
1 answer
1k 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 ...
Jenina's user avatar
  • 25
0 votes
1 answer
1k 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 ...
Jon Snow's user avatar
1 vote
1 answer
620 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? ...
Beta Tester's user avatar
0 votes
2 answers
122 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....
Aleh Lutsevich's user avatar

1
2 3 4 5
7