Skip to main content

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
1 answer
32 views

Getting error while sending email

Unable to send email using below code: Getting error: Error in sendEmailUsingTemplate: SendEmail failed. First exception on row 0; first error: INVALID_ID_FIELD, WhatId is not available for sending ...
Aman Bhatia's user avatar
-1 votes
1 answer
28 views

Unable to send Email

Unable to send email using below code: Getting error: Error in sendEmailUsingTemplate: SendEmail failed. First exception on row 0; first error: UNKNOWN_EXCEPTION, We don't recognize the field prefix ...
Aman Bhatia's user avatar
1 vote
1 answer
23 views

Emails not being sent from a quick action linked to LWC

I recently created an LWC to use as a quick action in the case field, to send a specific email with one click, I also created the class to call the records that I would need. I configured ...
Guilherme Sousa's user avatar
1 vote
0 answers
31 views

Why would setting "save as activity" to true throw "duplicate value found" exception when sending an email with a template?

First thing first, I have gone through this thread where "duplicate value" is discussed - How to debug the mysterious "duplicate value found: <unknown> duplicates value on record ...
Mitesh Sura's user avatar
2 votes
0 answers
102 views

Converting Rendered Email Templates to PDFs - issue(s)

I'm hoping someone here will be able to help me as I have been trying different "solutions" for days now...to no avail. I am new to Apex and do have some Java in my backgorund...not much ...
greeng13's user avatar
2 votes
0 answers
90 views

SingleEmailMessage Sends Email, but EmailMessage not associated With the Case

I'm using the following code to create a list of Messaging.SingleEmailMessage: List<Messaging.SingleEmailMessage> emailNotifications = new List<Messaging.SingleEmailMessage>(); for (Id ...
Ron Van Aken's user avatar
1 vote
0 answers
141 views

Issue with attachments when resending an e-mail (that belongs to a Case) via Apex

I have an Apex batch job that periodically resends mails that belong to Cases. It creates a SingleEmailMessage, copies all relevant fields from the previous, most recently sent, EmailMessage and sends ...
Sander de Jong's user avatar
0 votes
0 answers
34 views

What is the difference between SingleEmailMessage and MassEmailMessage?

While i'm sending Email for 30 records both are getting Limit exceed Exception Through Batch apex i give batch size as 10 but still getting exception.This is my code global class ...
user147601's user avatar
0 votes
1 answer
124 views

System.EmailException: SendEmail failed. We don't recognize the field prefix Contract

I am getting the error when i execute the sendEmailContractDetailsToOwner() method from ContractsService class. My email template has couple of merge fields such {{{Contract.ContractNumber}}} Domain ...
selman's user avatar
  • 25
2 votes
0 answers
643 views

System.TypeException: "emailSimple" isn't a valid action type

I am trying to use an standard Invocable Action "Send Email" from my apex code with the following snippet: Invocable.Action action = Invocable.Action.createStandardAction('emailSimple'); ...
Gabriel Serrano Salas's user avatar
1 vote
0 answers
96 views

Can read receipts be used with emails sent from Apex?

Are we able to track if emails sent through Apex code are read/opened? Sending emails via Messaging.SingleEmailMessage creates an EmailMessage record but does not track when I open it like a email ...
UserIsStuck's user avatar
0 votes
0 answers
429 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
568 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
53 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
199 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
83 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
70 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
234 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
428 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
  • 703
0 votes
2 answers
867 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
1 answer
79 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
1 vote
1 answer
4k 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
270 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
1k 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
-1 votes
1 answer
47 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
274 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
  • 724
0 votes
0 answers
240 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
156 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
  • 303
-1 votes
1 answer
71 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
2k 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
133 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
299 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
1k 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
610 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
496 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
349 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
1k 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
352 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
3k 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
441 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
623 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
174 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
627 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
0 votes
1 answer
783 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
  • 351
1 vote
1 answer
2k 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....
SK2889's user avatar
  • 921
-1 votes
1 answer
207 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
175 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
4k 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.9k
-1 votes
1 answer
51 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

1
2 3 4 5
8