Questions tagged [singleemailmessage]

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

Filter by
Sorted by
Tagged with
0
votes
2answers
31 views

Email Limit Exceeded on Batch Apex

I have a batch job which sends email notification in bulk using Messaging.sendEmail() and its using setTargetObjectId to set the reciepient. It sends out thousands of emails but one day I got case ...
0
votes
0answers
6 views

Empty Attachment related list in the Email Activity History when sending Outbound Email Message

We are sending an email using Messaging.SingleEmailMessage. When sending an email, the email body text and the attachment successfully sent to the Email inbox. But when I go into the activity history ...
0
votes
0answers
15 views

First exception on row 0; first error: INVALID_CROSS_REFERENCE_KEY - SendEmail failed

sending Email from Public page Site, Getting following error, It was working earlier, not sure suddenly getting this Error in LOG common.apex.methods.MessagingStaticMethods$EmailExecutionException: ...
0
votes
0answers
12 views

How many emails or SingleEmailMessages can be sent as part of a single sendEmail method invocation? [duplicate]

I see the governor limits for maximum no. of sendEmail invocations per transaction as 10 in this article https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_gov_limits.htm#...
0
votes
0answers
10 views

SendEmail does not save activity - INVALID_ID_FIELD, SaveAsActivity is not allowed with whatId that is not supported as a task whatId

I am sending an email using batch class and want to save it as activity. But getting following error: INVALID_ID_FIELD, SaveAsActivity is not allowed with whatId that is not supported as a task whatId....
0
votes
0answers
21 views

Can we save attachment in activity using apex

I'm using an apex single email message to send an email with an attachment. Everything is working fine. But in the activity history, I can only see email body details but attachment not saved in ...
0
votes
0answers
23 views

writing css in apex class

I have an issue which I need to send email from Apex, the email can be received in Gmail or Outlook emails. I need to style the context and I'm using inline CSS in my HTML tags. The issue is that ...
1
vote
1answer
22 views

stop email to be sent via apex

I have a Batch process which sends an email in the finish method. I tried to check some records that failed via this process and since My JSON contains thousands of records, I decided to replace this ...
0
votes
0answers
31 views

How to display continuation of task records sent from SingleEmailMessage using apex html

How to display continuation of task records sent from SingleemailMessage using apex html. I have sent email with task records using batch in html table, need to send 50 tas records per email but need ...
1
vote
3answers
71 views

Customize send time according to timezone

How we can send one single email to multiple customers based on their timezone. Let's suppose we have 10 US customers and as we have different timezones in every state. We have to customise email in ...
0
votes
1answer
67 views

How to use Messaging.SingleEmailMessage to force stop sending emails to email addresses that no longer exist / email server problem

So I have created a button on a Visualforce page to call the controller to send an email like so. It works perfectly for valid emails but little did I know the hell that came when I sending it to ...
0
votes
2answers
24 views

Creating an invocable apex class sending email with optional send from

I am trying to set up an invocable apex class to send an email to a contact with merge fields from other record ID types with an optional variable to set the sender. I have looked at this question for ...
0
votes
2answers
32 views

System.LimitException: Too many Email Invocations: 11

// Original Code for(Account obj :updateAsDuplicate){ obj.Duplicate__c = true; for(String oldStr : hasExternalIdOldSet){ if(obj.Id.equals(duplicateMap.get(oldStr))){ ...
0
votes
1answer
33 views

How to send email with new lines in apex?

In my app, there is a lightning:textarea in which the user can type the content that will be send as an email to the users. This is the textarea: As you can see from the image, the 'Thanks' is after ...
0
votes
0answers
8 views

EmailMessaging wont display the merge fields during the batchprocess

We have created a batchclass to send pending opportunity approval remainder email for the approvers as the flow we are sending email and referred a email template ID in which I have used merge fields ...
0
votes
1answer
28 views

Why is Primary Contact for Org Getting Added to SingleEmailMessage()?

Here is a method that fires when a guest enters their name and email address into a visualforce page and clicks submit. The email is being sent fine, but the primary contact on the org is also getting ...
0
votes
2answers
32 views

First exception on row 0; first error: INVALID_CROSS_REFERENCE_KEY

I have Visualforce email template which has recipientType="User" relatedToType="Enrollment__c" Getting Following error 11:53:56.0 (361868475)|EXCEPTION_THROWN|[109]|System.EmailException: SendEmail ...
0
votes
1answer
64 views

Prevent file from being duplicated as email attachment - Apex

I've button when i click on it it generates new file , i want to attach that file to email The problem i'm facing is that i found duplicate attachments when i click on button twice , 3 attached file ...
0
votes
1answer
40 views

how to remove unwanted things from mail sent from salesforce?

I wanted to send an email from my Apex class, and I used the following code: Messaging.SingleEmailMessage message = new Messaging.SingleEmailMessage(); message.toAddresses = new String[] { emailId }; ...
1
vote
1answer
44 views

SendEmail failed. First exception on row 0; first error: INVALID_CROSS_REFERENCE_KEY

I have custom LWC page as Public Site, In my Page i will be collecting the Name and Email address, On clicking send will insert the data in Custom Object and will send an Email to an given Email ...
0
votes
0answers
17 views

Pre Populating Body and Subject from Email Template into Subject and Body using aura components

I am a beginner in lightning components. I have a requirement to preview an email before sending it to users, contacts through Lightning aura components.I have an email template which i want to get ...
0
votes
0answers
58 views

System.UnexpectedException: Programmer error: cannot rollback to savepoint on another transaction

I am trying to send an email using the Visualforce template. VF Template <messaging:emailTemplate subject="Lead Score Card" recipientType="User"> <messaging:htmlEmailBody > <c:...
1
vote
0answers
25 views

How to send decrpy of field value in Single Email Message [duplicate]

I have a input form in LWC(It's a salesforce Public Site). Once the Form submitted by the user , we will generate the Random Password and send Email to User with username and password using Email ...
0
votes
0answers
44 views

Messaging.SingleEmailMessaging Sends duplicate emails to recipient

I am trying to send Krow expense list files to an email address. I have that functionality working, however it does send duplicate emails. I have added a debug message just before the sendEmail method ...
0
votes
0answers
58 views

SingleEmailMessage From APEX

Sending An email from Apex code. I have LWC button in Custom object, On clicking the button will call the APEX method by passing recordId and get the email address from the same record and send Email. ...
0
votes
1answer
48 views

Sending a Email Template from APEX

I'm attempting send a Text email from Apex code, Email is sending without body. I have created a new LWC button and Placed in custom Object Detailed page. On Clicking of the button this Apex method ...
0
votes
1answer
15 views

How to edit the visualforce email template properties in Apex controller

How to update the apex:dataTable used in the visualforce email template, when editing the properties of the visualforce template from Apex. I am able to query the markup from email template ...
1
vote
1answer
66 views

In Messaging.SendEmailResult what does the errors attribute contain?

I'm sending multiple emails using Messaging.sendEmail. After that I'm checking for the results by looping over the List<Messaging.SendEmailResult> just like the example below. Now my question is:...
1
vote
1answer
46 views

Help required with an Apex class that sends email

I am new to salesforce. I am practicing triggers. As a part of my learning, I wanted to send an email to the opportunity owner when an Opportunity is modified. I wrote a trigger on Opportunity and ...
1
vote
0answers
201 views

Email Message record creation through process builder

I want to create an email message record after sending an email template. Is there any way to create email message record through process builder or workflow after sending an email alert. So that we ...
-2
votes
1answer
48 views

Org wide address isnot properly in the From address of the mail

After receiving mail still it shows FROM address is "my email address(EG:****@gmail.com)" instead of org wide Email address. Trying to set Like below: From address=Org wide email Address, ...
-1
votes
1answer
56 views

Single Email Message isnot triggering

I have created following Template (Visualforce Page Template):GDPR_Subscriber_Notification If I do send Test and verify Merge fields option,Its working as expected <messaging:emailTemplate ...
0
votes
1answer
35 views

Outbound Email and Add Error are not working together

Actually i want to send email whenever duplicate record will create in salesforce and also show the error "Duplicate Account found" . I'm using for sending email through Outbound Email for salesforce ...
0
votes
2answers
373 views

sObject type 'SalesforceIqUser' is not supported

So I am trying to send out an email in the system and I am getting this error but I am at a loss. Everything that I am seeing has issues internally where you have to reach out to salesforce to have ...
0
votes
1answer
44 views

getting error while using SendEmail in batch class

I'm trying to send email to list of users using batch class, but its throwing below error for few records. Error: System.EmailException: SendEmail failed. First exception on row 0; first error: ...
2
votes
1answer
51 views

Visualforce as PDF error

I am creating a VF page where I have to select date and filter data and using button I need to send the another VF page as PDF with same data in email as attachment. When I selecting Date from 1st VF ...
0
votes
1answer
52 views

How do I test a schedulable email sending?

I have a schedulable apex class for the email sending. I tested a schedule, but I can't to coverage sending logic. Is there a some way to test good and bad scenarios for it? My class: public class ...
-2
votes
1answer
28 views

Salesforce Messaging.SingleEmailMessage Test Class

Can anyone help me get test coverage for Messaging.SingleEmailMessage? I'm using email template. Whenever a Case closes, it should send email to Contact.Email and bcc emails of the custom label. How ...
0
votes
1answer
160 views

Messaging.SingleEmailMessage email fails with invalid email address when using Target Object Id

I have a custom object that allows my users to create series of emails to their clients. I have a scheduled Apex job running hourly that scans for emails that are schedule to go out, creates the ...
0
votes
0answers
20 views

Problem sending email with attachment

I have a method to send email with attachment but some weird stuff keeps occuring where some emails + attachment arrived to the accounts that are returned by the query but some didnt receive anything ...
0
votes
0answers
80 views

How to add cc & bcc in Messaging.SingleEmailMessage Email and simultaneously avoid single Email limit being hit

My requirement is to send single email with To/Cc/Bcc added. All the email Ids belong to internal users. Initially, when I was passing the User.Id to these methods, I was hitting the Single Email ...
0
votes
0answers
89 views

Trigger sends more than one email

This email will send an email alert when an account has 8 cases open within 7 days. The email is being sent, but multiple emails for the Same account are being sent. I believe it has something to do ...
0
votes
1answer
59 views

Apex SingleEmail using template and userId

I'm trying to send a Messaging.SingleEmailMessage in Apex using a Custom Email Template to a specific User and using a defined OrgWideEmailAddress. The simple code is here: List<Messaging....
2
votes
0answers
18 views

Checking if an ORG Wide Email Address has been verified in Apex [duplicate]

I'm running into an issue where emails are not sending when an Org Wide Email Address is not verified. No exception is thrown either. In apex, I'm resolving the ORG wide that matches the users email: ...
-2
votes
2answers
219 views

How to call report in xlsx file format

could you please help me how to call report Xlsx file format, i am tried to below code, but i am not get the result: public class BatchUtilClass { @future(callout=true) public static void ...
0
votes
1answer
45 views

Remove email signature after sending single email with email template

here is the scenario. UserA has email signature in his setting. When clicking on a custom button, a template email is sent out to Person_B with sender UserA's name. Now the sent out name has 2 email ...
0
votes
1answer
64 views

How to set default value for List<Id> parameter and use it as argument

I have List as a parameter of the method but get the error when saving the class Error: Compile Error: Method does not exist or incorrect signature: void createEmailMessage(Id, OrgWideEmailAddress, ...
0
votes
1answer
102 views

Passing argument to List<Messaging.SingleEmailMessage> method

Hi I create List method with many parameters required than later be called in another void method sendRenewalReminder but I get this error Error: Compile Error: Method does not exist or incorrect ...
-3
votes
1answer
53 views

Sending Email while accessing fields from SOQL [duplicate]

Parent_Project_if_applicable__r is a lookup relationship on the Case object to the Parent_Project_if_applicable__c object. The If Block will send a group of emails to the addresses pulled from the ...
0
votes
0answers
15 views

Send Massive different emails to different contacts limitation

In my case, I have an email template. To construct the email body, I extract data based on who the contact I'm emailing to. For example, I send red-marked cases to user1, green-marked cases to user2, ...

1
2 3 4 5 6