Questions tagged [singleemailmessage]

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

Filter by
Sorted by
Tagged with
-1
votes
0answers
12 views

Why I am seeing null in my ToAddress field when i sent mail from apex? [closed]

I have used singleEmailmessage service in my apex class and I am sending emails via it. But whenever I received this email in my outlook inbox its 'To' field has null value. How can I overcome with ...
0
votes
1answer
30 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 ...
0
votes
0answers
25 views

HTML Visualforce Email Template for custom object lookup fields

I have a custom object called Class__c and Contact(Participant__c) is lookup field. I have set up an email alert every time a class button is clicked. But I'm unable to show the a lookup field value ...
0
votes
1answer
23 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
0answers
20 views

How can I send a file (pdf or word) from a library as an email attachment automatically?

I have tried to use the EmailAuthor URL hack by appending doc_id= as one of the parameters, but it loads the EmailAuthor page with all the details except the attachment. I tried with doc_id=...
0
votes
0answers
17 views

Send emails through apex - synchronous

I have a lightning component quick action on Opportunity that sending emails to Offer__r.Contact where Offer__r is a related list of Offers on the Opportunity. I have a need to update a counter fields ...
0
votes
1answer
27 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
1answer
18 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
1answer
28 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 ...
0
votes
0answers
26 views

Restrict user deactivation if Account is owned by the user and send an Email with details

please help. I am new to SFDC please help. Requirement: Restrict user deactivation if Account is owned by the user and send an Email with details. Trigger on user object: trigger userTrigger on ...
0
votes
0answers
16 views

How to convert an incoming email HTML body into a Content Document?

I have a use case where the HTML body of an incoming case email is needed as reference on several different objects. It would be easiest to just convert the email body to a Content Document, but how ...
0
votes
0answers
16 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
1answer
26 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
1answer
76 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 ...
0
votes
1answer
116 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 ...
4
votes
0answers
66 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 ...
0
votes
1answer
39 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)...
1
vote
1answer
96 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
1answer
35 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. ...
1
vote
1answer
37 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 ...
0
votes
0answers
34 views

Send email from Apex/programmatically through user's email (i.e. Office 365, Gmail)

I found it's possible to use Send through External Email Services and you can send emails through Office in Lightning Experience, but I have a custom UI for Email sending, so I'm not sure how to do ...
0
votes
0answers
24 views

How can I get template body [text] in apex class?

Here is my code below: List<Messaging.SingleEmailMessage> allmsg = new List<Messaging.SingleEmailMessage>(); Messaging.SingleEmailMessage mail = new Messaging.SingleEmailMessage(); ...
1
vote
1answer
208 views

Messaging.sendEmail not sending emails for non-admin profile in sandbox

In a partial sandbox I am calling Messaging.sendEmail through an @InvocableMethod through a Flow, and emails are not going out for a non-admin profile. There are no errors anywhere and even debugging ...
1
vote
0answers
28 views

How to show "From Name" in Email Template

I want to show specific From Name in the email template as I have more than one record in the Org wide address. Can anyone help how to do it? Note : I am always getting the current logged in user name ...
0
votes
1answer
66 views

Apex Class Not Sending SingleEmailMessages [closed]

To begin, I'd like to explain that the following class works in tandem with a process that detects incoming email messages to a case and then sends the ID of that email message to the class. The class ...
-3
votes
1answer
33 views

NOT able to Save either VFP or APEX class [closed]

MY VFP::: <apex:page controller="EmailControllerClass"> <p> compose Email::: </p> <apex:form> <apex:outputLabel value="...
0
votes
0answers
33 views

How to change "from" address of email received via Email services

I am using Email services to catch the emails sent to Salesforce Email address configured in Email service. As we know, email address can not be set up as a custom address and has to be in a format ...
0
votes
1answer
43 views

Scheduled Apex Class Not Executing in Test Class [duplicate]

Hey guys so I’m having trouble with testing my scheduled apex class that is sending an email. The problem that is occurring for me is that when I click test, my System.assertEquals are not true ...
0
votes
0answers
32 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
27 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
45 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
30 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
38 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
84 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
106 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
59 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
62 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
68 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
81 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
89 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
41 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
335 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
103 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
239 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
304 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
13 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
77 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
276 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
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#...

1
2 3 4 5
7