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
22 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. ...
-1 votes
1 answer
23 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 ...
0 votes
0 answers
11 views

setInReplyTo(parentMessageIds) - add more than one address

Is it possible to set more than one address in setInReplyTo(parentMessageIds) - SingleEmailMessage Description: Sets the optional In-Reply-To field of the outgoing email. This field identifies the ...
1 vote
1 answer
56 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 ...
0 votes
1 answer
22 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 ...
0 votes
2 answers
62 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 ...
0 votes
1 answer
49 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> </...
  • 15
0 votes
1 answer
39 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?
0 votes
0 answers
33 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 ...
  • 1
-1 votes
1 answer
28 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 ...
-1 votes
1 answer
49 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. ...
  • 313
0 votes
0 answers
35 views

Email attachments not working in apex controller

I have an aura component that uses the following apex class. I want to attach files and send them as email attachments. Everything works fine except the attachment. The file is attached to the email ...
0 votes
0 answers
187 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: &...
0 votes
1 answer
88 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....
-1 votes
1 answer
23 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 ...
-4 votes
1 answer
85 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(...
  • 1
0 votes
1 answer
295 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 ...
0 votes
1 answer
263 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 ...
0 votes
1 answer
102 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
482 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-...
  • 11.1k
-1 votes
1 answer
43 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
345 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 ...
  • 15
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
415 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
302 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,645
1 vote
1 answer
223 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
67 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
579 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 ...
's user avatar
0 votes
1 answer
172 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
67 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
213 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 ...
  • 190
0 votes
1 answer
302 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
96 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 ...
  • 679
0 votes
1 answer
346 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 ...
2 votes
1 answer
1k 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/...
  • 51
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 ...
  • 616
0 votes
1 answer
228 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 ...
  • 3
0 votes
1 answer
56 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
1 answer
48 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
69 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
703 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 ...
  • 963
0 votes
0 answers
66 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
79 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
590 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 ...
  • 55
0 votes
1 answer
835 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 ...
  • 55
4 votes
1 answer
177 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 ...
  • 49
0 votes
1 answer
132 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)...
  • 49
1 vote
1 answer
175 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
375 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,500
2 votes
1 answer
193 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 ...

1
2 3 4 5
7