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

learn more… | top users | synonyms

2
votes
1answer
32 views

Google is making a change to DMARC that affects Salesforce

If you took a looked into Salesforce-Outbound-Emails-Impacted-by-Google-DMARC-Policy I understood we can't use other gmail address to send email from salesforce instance. So as per my understanding ...
0
votes
1answer
33 views

Setting a from address in SingleEmailMessage not by organisation wide email address

I have a requirement where the ‘from address’ need to be changed . According to business logic cannot use “Organization wide email address” When ever the record is updated , From address should ...
0
votes
0answers
35 views

Remove Email Footer while sending an email to contact

While sending an email to a contact a footer is getting included. I have to remove this footer I went through "Organization-Wide Email Footers" and have set one as a default footer. But my footer is ...
0
votes
0answers
20 views

how to send email to Account Owner from contract object in Batch Class

Can any one help me out . How to send an email to Account Owner from contract object in Batch Class.Im using templateid ,in target object im giving the contact id ,in whatid im sending the Account ...
1
vote
2answers
70 views

Need to restrict the email notifications to only those tasks created by the specific profiles

For The above requirement how to restricted email notification for specific profiles.For that i have written a trigger mentioned the below but that code is not working as expected. could any one help ...
2
votes
1answer
46 views

No Limit on Sending Individual Emails to Contact, Leads, Person Accounts and Users

As per the documentation: Single emails sent using the Salesforce application don't count toward this limit. There’s no limit on sending individual emails to contacts, leads, person accounts, ...
1
vote
0answers
38 views

Clarification on SingleEmailMessage changes in Winter '16

Anyone knows the implications of this new method? setTreatBodiesAsTemplate(treatAsTemplate) Optional. If set to true, the subject, plain text, and HTML text bodies of the email are treated as ...
0
votes
1answer
25 views

issue adding csv file attachment to email in Batch job

In a batch file we are updating records, and for each one we are creating a record which is sent in an email when the batch completes. It all works swimmingly except that the csv file is sent as an ...
-1
votes
2answers
25 views

Issue with Merge fields when I send email through trigger

Hi Can you please debug and fix this trigger. When I send a mail through trigger merge fields are not picking automatically. Its showing empty. trigger SendEmailNotificationtoCandidate on ...
3
votes
2answers
84 views

Do email results come in the same order as the list of emails

I populate a list of emails emailsToBeSent and send them all at once. However These emails are related to different sObjects. And to me it is important to know which sObject the returned results are ...
0
votes
1answer
34 views

Multiple attachments creation in single email apex class

I have to create multiple attachments in a single email method. Below is my email class. Can someone help me? Apex Class Messaging.SingleEmailMessage email = new Messaging.SingleEmailMessage(); ...
0
votes
1answer
29 views

Email class fails to trigger email

I have below email class that fails to trigger the email class. I am not getting the reason in debug log even. Can someone let me know where I am making the mistake? Apex class method public ...
1
vote
1answer
24 views

Return toaddress of a singlemailmeessage [closed]

I am trying to do the following the singleemailmessage has been created here. public List<String> getToAddresses(){ System.debug('toaddress'+singleEmailMessage.toaddresses); ...
0
votes
0answers
41 views

Unable to use treatBodiesAsTemplate when sending email using SingleEmailMessage

I need to be able to add {!Case.Thread_Id} at the end of the email message. But this code throws an error: public static void sendEmailWithRef(String caseId, String templateId) { Case[] ...
2
votes
1answer
98 views

Send mail to the System Administrator

I have tried this to send mail to the logged in user String[] toAddresses = new String[] {UserInfo.getUserEmail()}; mail.setToAddresses(toAddresses); This works fine for the users who have logged ...
0
votes
1answer
76 views

apex email ReplyTo address not display in outlook

I'm developping an automatic email on apex code. It works fine, but the reply to adress is not display in Outlook, but it's ok in Thunderbird. Anyone have an idea ? This is my email code : ...
1
vote
1answer
48 views

Schedulable Class with Messaging.SingleEmailMessage Utility Code Coverage

Here is my dilemma, I have a Schedulable Class that is set up to send an email reminder on a Task. I have two solutions; (1) The Schedulable Class that includes the Messaging.SingleEmailMessage ...
3
votes
4answers
126 views

Best Practice for Sending Emails via Apex

I'm playing around in my Dev org and am using a trigger to send a basic e-mail to System Admins when an account is created as follows: private static void doNotifyAdmin(List<Account> acc) { ...
0
votes
2answers
72 views

Multiple attachments in singleemail class

I want to attach two (2) pdf files in a single email. Please find my below code which is doing attachment for only one of them. Can someone please help me here? Controller snippet: PageReference pdf ...
1
vote
0answers
26 views

How to use SingleEmailMessage.setReferences Method

According to the documentation, the setReferences function "Identifies an email thread. Contains the parent emails' References and message IDs, and possibly the In-Reply-To fields". I can't actually ...
0
votes
0answers
21 views

Respect SendEmail API and SendEmail API

While I am looking for a solution for my test failure, I found the below solution, Though it resolves my problem I still have a doubt about "Respect SendEmail API" and "SendEmail API" Mentioned in ...
0
votes
1answer
34 views

SingleEmailMessage Limitation in developer and in production Environment

Good day everyone, I am using SingleEmailMessage in developer and it seems that there is a limit of emails that can be sent. I just want to know if is it still limited in the production environment ? ...
3
votes
1answer
174 views

How to test SendEmailResult for SingleEmailMessage

How could I write unit tests for the SendEmailResult. I want to generate erros in to errResult parameter. What are the possible ways of testing this. Messaging.SingleEmailMessage message = ...
0
votes
2answers
24 views

Email body issue

I have tried to form the email body of a singleemail message as below but it is giving Line break errors. Can someone help me here? String body = 'Dear ' + OneMap.get(mycontact.ID).Rep_abv__r.Name + ...
1
vote
2answers
110 views

Getting error at line 39 saying Incompatible value type String for Map<Id,User>

I have written one batch class and i am taking a count of No_of_active_CP_on_Account__c and No_of_active_CP_on_Contact__c .I need to send mail to Account owner once batch apex runs. So for retrieving ...
0
votes
0answers
38 views

Using text email template but merge fields does not appear?

I created a text email template and made a test send. During the test send, merge fields are displaying properly, but when i use the template for single email messaging, the merge fields does not ...
4
votes
1answer
94 views

SingleEmailMessage setReplyTo not working with some clients

Even though the ReplyTo property of SingleEmailMessage is set to a "noreply" address we are still getting emails sent to our admin email. This only happens with certain email clients (e.g. Gmail ...
2
votes
4answers
171 views

Put Paragraph tag for email send body

I am getting error while putting paragraph tag for emailbody as below. Can someone suggest the wayout here? mail.setHtmlBody(<p style="font-family:Calibri"> body</p>); Error: ...
4
votes
1answer
155 views

Email not being send if whatID is set and setSaveAsActivity is true

I have the following code if (this.templateId != null) { // parameters specific for visualforce template singleEmailMessage.setTargetObjectId(this.targetObjectId); ...
0
votes
1answer
37 views

Send Email to Rep_abv__c field of Update Records

I have below method where Publish operation occurs. Here I can get in Debug log that SetToAddress is coming as Null hence Publish operation not working. For the rest everything is fine. Please let me ...
-1
votes
1answer
46 views

i have records to be processed in vCommonRecords. i am not receiving the emails with expected results

My actual task is : 1.I have Account object it is having 2 child objects contacts and Orders. 2. need to process the account records with record type = Branch Integrated 3. need to send email ...
0
votes
1answer
101 views

Retrieve Inbound Email Service address in Apex

I need to create a system to allow customers to submit documents for approval automatically. The design is: A button on the lead/contact page to send a request for a document. That buttons sends an ...
0
votes
0answers
55 views

Page Reference for an report

I have a report saved in salesforce under report tab. I am trying to create a class which would attach this report( in csv ) to an email and send it to some people. I checked this link - ...
3
votes
1answer
1k views

SingleEmailMessage setTargetObjectId, but do not send to Target

My code is as follows: List<Messaging.SingleEmailMessage> emails = new List<Messaging.SingleEmailMessage>(); Messaging.SingleEmailMessage email = new Messaging.SingleEmailMessage (); ...
2
votes
1answer
82 views

Does sending SingleEmailMessage with template use a SOQL query?

I'm getting a somewhat strange error message when trying to send a list of emails System.EmailException: SendEmail failed. First exception on row 11; first error: LIMIT_EXCEEDED, ...
0
votes
1answer
132 views

Unable to Save email in the Activity History

I have a custom button to send an email. The code is working fine. Now I would like to insert those email in the activity history. I did set mail.setSaveAsActivity(true). But when I click the ...
1
vote
2answers
398 views

How to save activity while sending email from custom object

I have a custom object 'XYZ' on which I have a button "Send Email", When user click on this button a email will be sent to the email address mentioned on the record of XYZ. Now my requirement is to ...
2
votes
1answer
565 views

setsaveasActivity

I am trying to send an email to Order Contact and Order Owner and saving it as Completed Task(Activity History) against Order but Sent Email is saved against Contact's Activity History.How to save it ...
2
votes
1answer
73 views

Batchable Class from a List, not from a query

Is it possible to run a batchable class from a List<sObject> that is passed into the constructor as opposed to generating a scope list from a query? For example, I have a list of ...
3
votes
1answer
159 views

Encoding used when sending emails through singleemail method

When sending out a single email salesforce encodes the HTML body As per doc : ...
3
votes
1answer
549 views

LetterHead in Apex

Is it possible to access LetterHead in apex.I need to put the letter head in sethtmlbody method.How to access LetterHead. UPDATED Here the bt.value is displaying blank when contact is receiving an ...
4
votes
1answer
247 views

WHY Can't I Use SetTargetObjectId(UserId) and SetWhatId?

I have a very simple error handling case. I need to send an email to the running user, who almost certainly does not have an associated Contact record. I also need to specify the error record in ...
3
votes
1answer
398 views

How can I send an email alert every day to 5000 contacts

We want to send an email to contacts every day. There will be say 5000 contacts. I can't do this with apex code because there is a limit of 500 emails per 24 hour period. So I will have to do this ...
1
vote
1answer
25 views

SingleEmailMessage with public sites user throwing error

is anyone using a public site and sending an email with this public sites user through an apex class with the SingleEmailMessage Method. It always worked very well but since some time i get the error ...
1
vote
1answer
405 views

Why are my merge fields not populated when sending email through Apex?

I am using an email service and apex class to handle inbound emails and attach them to an associated custom object record. The same Apex class is also sending an email to the user in the "Assigned to" ...
0
votes
1answer
587 views

Send email with excel attachment - Blob variable doesnot exist error

I have a Map. that I built in apex class. I want to put that map output into an excel and send it as attachment. Here's the code that Im using. I get Blob variable doesn't exist error ( in the ...
0
votes
2answers
132 views

Batch class approach restrict multiple email

I have a requirement to send mails some Users (DM lookup ids) notified about creation of records in a custom object based on a specific filter criteria. Now if there are records in different batches ...
4
votes
1answer
77 views

dailly email limits

I have gotten this error in production SINGLE_EMAIL_LIMIT_EXCEEDED I am sure i have maxed out the daily email limit of 1 000 limit info ...
0
votes
3answers
282 views

SendEmailError Messaging.SendEmailError[getTargetObjectId=null;]

I've written a method which should send messages to the current user, the System Administrator, and a list of other addresses that I specify. public static void sendErrorEmail(String body) { ...
1
vote
1answer
134 views

Get ActivityId From SingleEmailMessage

When sending a SingleEmailMessage from apex to a Contact, activities are automatically created for that Contact. I also want to log an activity on records that are related to this email. I can't use a ...