Episode #125 of the Stack Overflow podcast is here. We talk Tilde Club and mechanical keyboards. Listen now

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

Too Many Email Invocations / Sending ALL attachments

Problem: I am sending 1 confidential pdf for each contact. I am using SingleEmailMessage. When I include the Messaging.SendEmail() inside the For Loop and send it to no more than 10 contacts, each ...
-2
votes
1answer
13 views

Send Vf Page as attacment to multiple Users through Schedule class [closed]

I have a requirement that I need to send Vf page as PDf attachment using schedule Class. For every records Vf page will have different Value. How to pass record Id to the page for different records ...
1
vote
1answer
15 views

Is there any way to send an email from Apex to Email-To-Case, with dynamic from address instead of Running User

I have a form, where the user will fill all the information. Once the record gets created I wanted to invoke the Email-To-Case by passing record Id as the subject. Here, I wanted to set the From ...
0
votes
0answers
24 views

Email sending from Sandbox is Inconsistent

In one of our sandbox, we are testing some funcationality which sends the email from workflow when ever a case with specific subject is created. But the problem is email sending is very inconsistent i....
0
votes
0answers
19 views

Reply EmailMessage using SimpleEmailMessage apex class

In an Email-To-Case process, after receiving an email, a Case and an EmailMessage (A) are created. When the case is updated and a condition is verified, a "reply" email (related to Case and to the ...
0
votes
0answers
18 views

Email Message Object - Sanitize HTML Body

I use an output panel and rerender to display the HTML Body of an Email Message object query that is invoked by a user. There is an issue (confirmed by Salesforce Support) with rerendering an ...
0
votes
0answers
29 views

Email not sent from Partial Sandbox using Batch

I have a simple batch job that is used to send a notification email. I'm testing in a partial sandbox, but the email is not coming thru. Here is what I've checked: I verified that deliverability is ...
0
votes
0answers
10 views

Outbound Email With Inline Image

This is not a problem that needs an immediate solution but I have been thinking about it and researching it and I don't have an answer so I figured I would ask the community. I am writing a VF page ...
2
votes
1answer
26 views

test class for opportunity trigger not fully testing the entire code

my trigger trigger EmailTest on Opportunity (before insert) { id ac; List<Messaging.SingleEmailMessage> mails = new List<Messaging.SingleEmailMessage>(); for (Opportunity opp : trigger....
0
votes
1answer
45 views

What Are IP ranges for APEX outbound emails to be used with SMTP Relay?

I am trying to configure SMTP Relay with GMail through salesforce. I have white-listed all the email Ips and ranges called out in the salesforce help doc in Gsuite for smtp relay, and it seems to be ...
5
votes
1answer
75 views

Streaming API not working when email is sent from Apex Batch

I have a Batch class that updates Last_Date__c on Project__c object in the Finish method. I have a PushTopic 'LastDateUpdate' on Project__c which is fired when Last_Date__c is updated. I'm ...
2
votes
1answer
78 views

Missing email activity when SendEmail failed: EMAIL_ADDRESS_BOUNCED, The target object email address is currently marked as bounced

Salesforce recently stopped creating email activity records for emails which failed because they bounce. Below is the error I am getting: SendEmail failed. First exception on row 0; first error: ...
1
vote
0answers
11 views

What is the difference between Mass email and single email? [duplicate]

i'm writing some code that is going to be sending email reminders to customers. I don't know whether to use single email with a loop to generate all the emails and send them out as a list or to use ...
0
votes
2answers
46 views

How to test and assert email template?

I'm getting this error: System.DmlException: Insert failed. First exception on row 0; first error: MIXED_DML_OPERATION, DML operation on setup object is not permitted after you have updated a non-...
0
votes
0answers
14 views

VF Email template - send different bodies to same person

I have a batch which I use to send emails to contacts - the emails are Messages about courses - so Each Contact should have the same email template repeatable with a different body. So, I created a ...
1
vote
0answers
19 views

Email Relaying Not Working When email is sent from Apex

Our application has a few features where we allow the user to generate documents and send emails. This is all custom lightning components and apex code. We send the emails using SingleEmailMessage. ...
1
vote
0answers
39 views

Email Limit on Scratch Org?

Working in SFDX with a scratch org. I'm setting up a future method to send an email if it fails, trying to get the formatting right, and testing. Now, I've hit a wall: SINGLE_EMAIL_LIMIT_EXCEEDED, ...
0
votes
0answers
24 views

Messaging.SingleEmailMessage translated labels

I have a batch that sends an article through email to contacts. I have a field in the Article Object which indicates the lang of the article. I'm using Messaging.SingleEmailMessage and I have ...
0
votes
0answers
37 views

Send email with different language via Apex

I have a batch process which I'm creating Emails without a template - with HTML Body - which there I should style the emails and send them to the contacts. The emails are built in a way which I go ...
0
votes
0answers
56 views

SendEmail failed. First exception on row 0; first error: UNKNOWN_EXCEPTION, DML currently not allowed: []

Need some help in understanding error , SendEmail failed. First exception on row 0; first error: UNKNOWN_EXCEPTION, DML currently not allowed: [] . I get this error when calling send email method ...
0
votes
0answers
11 views

View the history of SingleEmailMessage usage

I know how to see how many SingleEmailMessages we've sent in the current GMT day, but I need to know if it's possible to see a history of emails further back than that. For example, for the past week, ...
0
votes
0answers
31 views

Attachments are not visible if setWhatId is not defined while email from Apex

I am sending email to selected Contacts (Custom Component) via Apex. User will also be attaching multiple files to the email. If setWhatId(setting it to Case) is defined, EmailMessage Activity shows ...
0
votes
1answer
23 views

user merge fields doesn't replace by user record ID

I am trying to send email through email template to user but It is always replacing the user merge fields by org admin's user name instead of targetobjectID user. Org admin : luke wright Email ...
1
vote
1answer
88 views

SendEmail Method results in EmailMessage Object in Sandbox - Does not in Production

I am using the following logic to send emails. Enhanced email is activated on both orgs and so is Email-to-case. In the sandbox (Summer '19), executing this method results in an email message ...
0
votes
0answers
43 views

Community Profile User unable to send APEX emails

I have a class containing this method that creates an email in APEX and sends it out once the method is called. public static void generateMessagingTemplates( String requestLogId){ String ...
0
votes
0answers
46 views

The content that i received through mail as a pdf attachment is partial of the actual content sent

public static String AcceptTnC(String contractInfo2){ system.debug('contractId2'+contractInfo2); Messaging.SingleEmailMessage semail = new Messaging.SingleEmailMessage(); Messaging....
0
votes
0answers
29 views

ReRendering Output Panel with MHTML String Fails

I am rerendering EmailMessage HTML Bodies onto visualforce pages. For most emails this is not a problem, however for one email the rerender never completes. Research into this suggests some sort of ...
0
votes
0answers
33 views

PDF Generation: Classic Email Template Content is counted in Salesforce Apex Code Limit?

We need to send PDF based on salesforce record. For this we have used Classic Email Template and Messaging.Singleemailmessage class to send PDF as attachment. We have used custom template for ...
0
votes
1answer
29 views

Single Email limit per execution using Apex Trigger

How many emails will be send using trigger per execution?
2
votes
1answer
179 views

Invalid Message Id Reference - In-Reply-To Header is Not Valid

I am designing a custom mail application with Visualforce and Apex in salesforce and I'm running into some issues maintaining threads and setting reply to ids. To establish which emails are a ...
0
votes
1answer
61 views

HTML Email Status won't get created if setWhatId() for Messaging.SingleEmailMessage is specified

In my org I've set up an automatic process that sends email messages with the Custom template (with the HTML) to the contact. It has triggered similar code: OrgWideEmailAddress addr = [select Id from ...
2
votes
1answer
83 views

Error when using setOrgWideEmailAddressId in SingleEmailMessage [resolved]

I'm trying using setOrgWideEmailAddressId in my class Apex but he return this error: 718403274-125341 (195485361) Code: @AuraEnabled public static void sendEmailReference(String strEmail){ ...
1
vote
1answer
362 views

Test class Limits.getEmailInvocations() showing zero and assertion is failing

I have a bizarre issue. I have a trigger that will send an email based upon a record update. When I debug my trigger running the test class it showing the email result as success and when I debug and ...
0
votes
1answer
24 views

Using SingleEmailMessage to send email with template to an email that might or might not be a contact

Normally to send an email with a template this is how you would do it. Messaging.SingleEmailMessage mail = new Messaging.SingleEmailMessage(); mail.setTargetObjectId(contact); mail....
0
votes
1answer
47 views

MIXED_DML error only on UpsertResult has errors

In a @Future method (because of other MIXED_DML problems) we are upserting users and collecting the results. We then want to send an email once the transaction is complete. If everything works well, ...
0
votes
1answer
25 views

Email sent from Lead is counting under daily limit

I was going through the salesforce document Daily Allocations for Email Alerts It is mentioned that There’s no limit on sending single emails to contacts, leads, person accounts, and users in your org ...
0
votes
2answers
63 views

notify user by sending an email to user whose last-login is more than 1 day

Here is my code, please check global class LastLoginEmail implements Schedulable { global void execute(SchedulableContext SC) { List<User> uds =[SELECT Id, LastLoginDate, Email FROM ...
0
votes
1answer
685 views

SendEmail failed. First exception on row 0; first error: UNKNOWN_EXCEPTION, java.lang.NullPointerException: []

I am getting this error message: Message: SendEmail failed. First exception on row 0; first error: UNKNOWN_EXCEPTION, java.lang.NullPointerException: [] Stack Trace: Class.MessagingHelper.send: ...
1
vote
0answers
149 views

Messaging sendEmail Issue

I'm using a single email message to send an email. When we tried to sent an email with a wrong email address on newly created lead record. I'm getting message result success is true. But the same ...
0
votes
2answers
34 views

Add bccAddresses to SingleEmailMessage

I'm trying to send an email and to add some bcc addresses to it. I don't get an error, I even get the debug statement: "The 1st email was sent successfully." and the email is sent to the email main ...
0
votes
1answer
213 views

Set ParentId on SingleEmailMessage

I reviewed the documentation for the SingleEmailMessage but haven't found how to add the parentId (i.e. case Id) to the email message, is this even possible? I want to be able to see the email on the ...
0
votes
1answer
26 views

HTML link attachments and a bash script to download them all

As the title implies. I'm looking for a bash script that will iterate over html files in a folder and download the files to the same folder. I'm hoping someone in here has run into this before and hs ...
0
votes
1answer
265 views

Outbound email message with attachments limit

I am using Apex to send emails with attachments to users (with SingleEmailMessage to be more precisely). From some MB (I Don't sure exactly the size - because it changed from time to time when I try ...
0
votes
0answers
62 views

Exporting attachments via contentType results in some .pdf coming through as .url or .html

As the title implies. Here is the code. List<Messaging.SingleEmailMessage> attachmentEmails = new List<Messaging.SingleEmailMessage>(); Map<Id, Case> caseMap = new Map<Id, ...
0
votes
1answer
53 views

How to test email notification to the Administrator?

I can't insert right profile to test user like an administrator and don't know how to test it right. Help me please. public void notifyAdministrator(String errorException){ User user = [SELECT ...
0
votes
1answer
24 views

Send email with multiple bodies

I have two custom objects: Parent__c and Student__c with Master-detail relationship. Parent__c object has Email__c field. I need to send email to Parent__c with link(s) to Student__c object(s). I have ...
0
votes
1answer
23 views

Is there a certain way you need to call targetObjectId?

So normally I would send an email by normal means and without code but I need to do a query on our Team__c object to find out who I would need to send it to. I am trying to send an email to any "squad"...
1
vote
0answers
97 views

Understanding EmailMessage for Data Migration

As I attempt data migration from one Salesforce org to another, I am finding EmailMessage to be a very unnecessarily complicated object to understand. At one point I thought I understood that recent ...
2
votes
1answer
265 views

Messaging.SendEmailResult Type cannot be constructed?

I'm trying to create a simple mock of messaging Messaging.sendEmail and in my code I'm trying to do the following to construct mocked instances of Messaging.SendEmailResult Messaging.SendEmailResult ...
0
votes
1answer
73 views

Testing/Mocking design pattern to test Messaging.SendEmailResult

I have some code in an After Insert trigger that does some conditional DML updates to the records being inserted if a mail is successfully sent out. I'm looking for a solid, modular way to test this, ...