Questions tagged [singleemailmessage]
Relates to the SingleEmailMessage class, which provides methods for sending single email messages through apex.
291
questions
0
votes
0answers
17 views
Delete or change on behalf from mail
I know it has been answered but there are different opinions about how to do it in a community.
Using apex is clear (if i understood correctly):
Messaging.SingleEmailMessage mail = new Messaging....
0
votes
0answers
19 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
0answers
19 views
How can I Email-to-Case Routing if my email system organization doesnt allow externar forward rules?
I did the configuration of Email-to-Case but my Microsoft office 365 Admin dont allow me to create automatic rules on the email to redirect/forward emails with Thread id to My salesforce routing ...
0
votes
1answer
13 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 ...
0
votes
1answer
24 views
INVALID_EMAIL_ADDRESS, Email address is invalid:
I am writing a single messaging class where I need to send some emails. There are emails field on the Account. On matching some conditions, I need to send emails to that particular person which is ...
0
votes
1answer
33 views
email notification upon lead conversion
I have a custom object managers__c which has a lookup field Partnership_managers__c with User. when the lead is converted into an account, all the partnership managers should be notified with the ...
-1
votes
1answer
28 views
email with attached excel sheet in lightning/apex
I have requirement ,where i am searching for a record in search aura comp and if records found then i am attaching those records in Excel sheet and sending email to the user. But sending email is ...
0
votes
0answers
22 views
Can Emails sent via Apex be synchronized with Outlook Sent Emails
We have Outlook Email synchronization enabled in our Org. So when you use the standard Email functionality, then the email also appears in the sent folder in Outlook.
Is there a way to generate a sent ...
0
votes
1answer
22 views
Single Email Failed SaveAsActivity is not allowed with whatId Although the WhatId is Contact
I'm getting this exception where trying to send email:
SendEmail failed. First exception on row 0; first error: INVALID_ID_FIELD, SaveAsActivity is not allowed with whatId that is not supported as a ...
0
votes
1answer
27 views
How to Display Case Number on automatic email response with Email-to-Case
I am trying to include Case Number of an email template for an email-to-case.
Basically, when a client sent an email to a closed case, he received an automatic email reply. I would like the automatic ...
0
votes
0answers
13 views
Testing schedulable apex class that sends an email [duplicate]
I am relatively new to Salesforce development (I'm an intern) and I am currently struggling with achieving 75% code coverage when testing a class that regularly sends out an email. I have included the ...
2
votes
1answer
66 views
Code optimisation on EmailMessage
I have created a class and a trigger to be able to stop clients from sending email message on Closed Cases.
The code works as intended.
We tend to communicate with Clients using the quick action Email ...
0
votes
0answers
34 views
File Corrupt error in Excel using Reports as attachments in Apex
As title suggests i am using converting reports as attachment in Apex and sending as Email to users. The excel file is in .XLSX format when i tried to open the file i am getting file corrupt error.
...
0
votes
1answer
32 views
Mail not received - SingleEmailMessage()
I am working in Visual studio code. On the click of a lightning:button, I am calling a javascript method, inside the method I am calling a visual force page using window.open(url), submiting the form ...
0
votes
1answer
119 views
Batch apex finish method emails firing multiple times [duplicate]
I have configured finish method to send error files on csv upload.
It works ok for 200 records but if the sheet exceeds records more than 200 say 2000 I am getting emails for every job that has ...
0
votes
1answer
47 views
How to cover catch block in Messaging.SingleEmailMessage
I have a class that sends an email notification when a partner user posts in Chatter Feed. I wrote a test class which already covers most but I'm just having some difficulty here figuring out how to ...
0
votes
1answer
41 views
How to Link to a record in Lightning using Apex
I am sending an email notification to internal users from the community through Apex SingleEmailMessage when a partner user posts in Chatter Feed. I wanted to add a link to the Opportunity record into ...
1
vote
0answers
82 views
Messaging.renderStoredEmailTemplate() is rendering Visualforce email template without custom header
Messaging.renderStoredEmailTemplate() is rendering Visualforce email template without custom header.
I have a requirement to send an email with custom header. So created a visualforce email template ...
0
votes
0answers
12 views
Why mail is not working after installing app to another org?
In my app, I have a feature which sends emials to leads. This is the code I used:
Messaging.SingleEmailMessage message = new Messaging.SingleEmailMessage();
message.toAddresses = new String[] { ...
1
vote
0answers
27 views
Messaging.SingleEmailMessage with Template fails, but Messaging.renderStoredEmailTemplate() works?
I'm sending out a singleEmailMessage using a template. The Messaging.SendEmailResult reports success and the email comes through, but the template portion of the email is empty. (The WhatId is ...
0
votes
2answers
106 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
13 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
29 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
37 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....
1
vote
1answer
80 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
56 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
65 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
329 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
179 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
156 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
139 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
14 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
30 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
43 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
191 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
128 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
375 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
45 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
120 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
134 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
435 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
309 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
26 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
368 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
627 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 ...