Questions tagged [apex-email-service]

Email services are automated processes that use Apex classes to process the contents, headers, and attachments of inbound email.

129 questions with no upvoted or accepted answers
Filter by
Sorted by
Tagged with
6
votes
1answer
481 views

how to hide salesforce email address?

I have a requirement where... my company works for different clients(like Orange, Apple, Avacado,etc.) and it's customers. We send requests and quotes to different customers on behalf of different ...
4
votes
2answers
80 views

Duplicate Lead creation from EmailService

I have an EmailService that takes the data from an email and creates a Lead if no match is found for the supplied email address. If a Lead is found then the Lead is updated with the new details ...
4
votes
0answers
2k views

Email To Case - Duplicate Cases

Have an interesting problem with Email To Case setup, scenario is User A sends an email to a support mailer and copys User B on it. Auto response would go to User A. If User B picks up the first email ...
3
votes
0answers
127 views

The target object email address is currently marked as bounced

I have activated bounce management in two dev orgs. I am sending emails to record owner through batch class. If email is not valid, DEV1 org is throwing a message Email address is invalid and DEV2 org ...
3
votes
0answers
353 views

Email doesn't get sent even after changing the email address for error: The target object email address is currently marked as bounced

I am running into an issue when I want to send an email via apex. The problem happens occasionally only with some emails from some domains. The error in specific reports: Messaging.SendEmailError[...
3
votes
0answers
90 views

Does an Email Service accept Emails sent by phpmailer?

I have issues setting up an Email Service which should receive Email sent by an web-form using phpmailer. Now I've configured it like this: I've set no restriction to "Accept Email From" in order to ...
3
votes
1answer
611 views

Remove main email body and previous bodies of all replies in an email service

I have a problem with email service in apex. When I reply to the salesforce generated email address, then in my email service handler the body contains all the previous replies and main email body(...
3
votes
0answers
618 views

Email Services + How to handle undelivered or bounce emails

This might be a known issue. But i could not find enough info to resolve the issue. We are using Email Service's email address as a From address to send emails to consumers. If consumer's email ...
3
votes
0answers
2k views

Setup Auto-Response Rule when using Email-to-case for emails not related to an existing case

We have a specific workflow where most messages send to support and our other address is specifically given to the client once they have signed up and we email them directly. I am trying to setup an ...
2
votes
0answers
44 views

In a test class example of a Post Install script, sending an email and scheduling a class that performs an API callout

Scenario: In my example, as a part of the PostInstall (class implements InstallHandler) script I will be performing two actions; - sending an email to the installing User for the express purpose of ...
2
votes
0answers
396 views

Apex SendMail() method emails received when executed as anonymous but not from code

We have been struggling with this for a day now and the answers on the web have not been helpful, so I'll be explicit in describing our issue. We have implemented a wrapper method for SendMail() as ...
2
votes
0answers
143 views

How do I associate a reply email to a Lead with an Inbound Email Handler?

I am attempting to create an inbound email service that will add attachments to a Lead. The basic flow is: send an email with Apex to the Lead -> Lead replies to the email -> Inbound email ...
2
votes
0answers
131 views

which is best approach for custom email alerts, Declarative vs Programmatic?

Object_A and Object_B are two related(Lookup) objects in Salesforce, where A is parent and B is child. Requirement is, when a new Object_B record is created, an email alert should be sent to Object_B ...
2
votes
0answers
20 views

Scheduled Event invitees response template

When we add Attendees in an event then a email is sent out Template to Attendees Email Id. how can i track that template id and how to Modify that Event Response template. Based on that template id i ...
2
votes
0answers
324 views

Embedding an image in PDF attachment using html tags and Blob.toPdf()

I want to add an image to a pdf I am creating and attach it to an email that I send via apex code. I am using html and Blob.toPdf() to make the pdf. I saw this post regarding Blob.toPdf()'s ...
2
votes
1answer
207 views

Email Services Apex Class - Remove images and replace with text instructing user to check attachments section

I have put together an Apex class for a Salesforce Email Service. This is taking the email that is sent to the address, taking the subject and email body and creating a record for a custom object I ...
2
votes
0answers
3k views

Dynamic Email Template Body

I have a requirement where I need to send the email template and also allow the use to change it and then send the content. I am able to send email and attach a VF template dynamically. But I am not ...
1
vote
0answers
92 views

Make Lightning buttons Reply/Reply All/Forward visible for everyone

As per documentation Reply/Reply All/Forward buttons on EmailMessage are visible only for users who are mentioned in To/CC/BCC. In our case we need whole support department to be able to reply any ...
1
vote
0answers
23 views

How to make Reply, Reply All, Forward options available

I have created a new email service which populates a Lead__c field on the emailMessage object. Then i am displaying the emailMessages in a related list component. However, even though im getting the ...
1
vote
1answer
22 views

How to send an Email Alert that is Tracked from Process Builder?

I"m working with a Process Builder, and I'm able to create a messages record on the opp that has tracking turned on, but when I send the test email from the Opportunity, everything works fine except ...
1
vote
0answers
28 views

How can I send an email while using PageReference getContent() method?

I am trying to send an email while using PageReference and the getContent() method which is, only ocassionally, throwing an error (seems like every couple of emails regardless of the frequency). ...
1
vote
1answer
28 views

Email Service creating multiple Cases when sending to multiple aliases in a single email

Our org is currently using a custom Email Service to create cases and we have multiple Email Service aliases. Currently, when a customer sends an email to multiple Email Service aliases, our service ...
1
vote
0answers
38 views

Associate Task to attachment in inbound email service

Hello I have created a Email service to capture customer replies. It is working fine. But I am not able to associate Incoming Email attachments with task. I can associate`` them with contacts but not ...
1
vote
0answers
26 views

How to capture customer replies in Salesforce

We want to log outbound and inbound emails in Salesforce. Currently, We are sending Emails to Contacts using out of the box salesforce features and they re getting logged But when contacts reply to ...
1
vote
1answer
446 views

Email to Case (Using thread Id)

I am working on email to case. My requirement is whenever a user is sending mail from outside to salesforce generated email address, case should be created and reply back to user with case id in ...
1
vote
0answers
34 views

Capture Approval Email reply with Apex

In an Approval Process, with email approval activated, when an approver replied by email, is it possible to capture that email and do additional processing with Apex? What I want is to forward the ...
1
vote
0answers
176 views

Cannot query on IsPrivateDraft field of EmailMessage

I have a field named IsPrivateDraft in EmailMessage, I want to use that field for updating the draft EmailMessage. I want to know the value of this field but cannot use it in query. On using the field ...
1
vote
1answer
91 views

Fetching bccAddress from Messaging.inboundEmail

We are using Email Service and its handler class creates custom record in Salesforce based on its content. Please let me know if there is any possibility to capture the bcc address from Messaging....
1
vote
0answers
495 views

Email Template not working

I'm trying to send an Email with an attachment and a template. EmailTemplate emailTemplate = [Select Id from EmailTemplate where Name = 'Test Mail']; List<Messaging.SingleEmailMessage> allmsg =...
1
vote
0answers
38 views

Programmatically generate Inbound Email Service address

I have an Apex class implementing Messaging.InboundEmailHandler. Due to external constraints I have to use a new Email address for every Customer. If I am an administrator, I can define a new address ...
1
vote
0answers
23 views

Reading ICS file via Salesforce Email Handler

we have a request to read ICS file and generate activity in salesforce. I was able to from Google Calendar, Mac Outlook client via reading text attachment of ics file. But when with Windows Outlook ...
1
vote
0answers
366 views

Updating the Parent ID of Email Message. Working in Classic but not in lightning

Hi we have created a custom code for updating parent id of EmailMessage it is working in the classic but has error when we switch to lightning. Error we receive is Operation is not allowed Trigger:...
1
vote
0answers
201 views

Email Service implementation - Inline Images appear as 'Inline Image 1'

I have an Email Service set up to implement the Messaging.InboundEmailHandler interface. For Cases created through my Email Service, the images in the sent email appears as 'inline image 1' and ...
1
vote
1answer
18 views

Is there any way to embed buttons in Web to Lead Email?

I have a requirement wherein, I should be able to embed a button in salesforce email which I get when I(user) create a lead from Web to Lead form. I should get an email with a button in it which ...
1
vote
0answers
267 views

System.EmailTemplateRenderException: Too many SOQL queries: 101 Exception

Facing 'System.EmailTemplateRenderException: Too many SOQL queries: 101' exception while using visual-force email template with custom controllers. Api - Messaging.SingleEmailMessage templateInstance ...
1
vote
0answers
195 views

How can I see and delete Email Messages Records in the org?

I was looking at our Data usage in the org and realized that 7% of our data storage is taken up by Email Message Records. This document says EmailMessage represents Email Messages in the org. How can ...
1
vote
0answers
130 views

setFileAttachments method on MassEmailMessage class available?

According to the docs, MassEmailMessage class does not have the .setFileAttachments method. The reason why I'm using MassEmailMessage in the first place is because I cannot use the .setToAddresses ...
1
vote
0answers
82 views

What happens to emails being sent to orgwide address 'Return-Path' value

Some of our customers are replying to the 'Return-Path' value of emails being sent out by us (most likely through their email client or server settings, see my question here) I'd like to know what ...
1
vote
0answers
27 views

Can we send the follow up emails on the already send system email?

I have a requirement, as per which the system sends an email notification in each quarter to the Account contact for some document submission. Now, the system has to send a follow email after every 7 ...
1
vote
0answers
12 views

Options for a Simple Inbound Notification Methods to Trigger some processes

I have a dataloader process that pushes data into several different orgs. The process starts once a complex extract process has completed and created a set of files. I'd like to change the process ...
1
vote
0answers
159 views

Split a PDF apex page into separate PDF pages based on pagenumber

I have an Apex PDF page which I need to email to logged in User. Now when Page number exceeds 10 , I need to send in a separate PDF. Like if I have 15 Pages, PDF1 will have 10 pages , PDF2 will have 5 ...
1
vote
1answer
298 views

Batch Job-Mass email Contacts

I have a batch job that emails contacts using a visualforce template. I am using SingleEmailMessage to email contacts as the template pulls data from each contact. my batch size is 10 and we have ...
1
vote
0answers
39 views

will there be a delay in sending email for different id's

I have two contacts for which the email id's are say 123@abc.com for contact1 amd 234@xyz.com for contact2. When I send Email Message to 123@abc.com, I'm getting the email immediately. Whereas the ...
1
vote
1answer
590 views

Parsing plain-text body in Email service class

I am trying to parse an Email body for text that follows "name: " within a plain-text email. Should this not do the trick? The field is not being populated Pattern p = Pattern.compile('(?m)(?i)^name:....
1
vote
0answers
80 views

Regex works fine in regex101.com but get failed in salesforce api

Can anyone suggest what is not compatible with salesforce in below REGULAR EXPRESSION: (?s)^\s*Contact received.*(?-s)(?<=Phone Number:)\s*(.*) TEST STRING: Contact received E-mail Address: ...
1
vote
0answers
141 views

Remove the reference code from customer emails?

Salesforce includes a very strange and long reference code in the subject of customer emails, which I don't think is necessary, because it's also included in the body of the email, and just ends up ...
1
vote
0answers
904 views

How to set multiple “setwhatIds” and “setTargetObjectIds” in salesforce?

How can I set multiple objects Id in targetObjectsIds and WhatIds?? Whenver I tried to do that it gives an error String[] bccAddress = new String[] {'contact@testcompany.com'}; Messaging....
1
vote
1answer
1k views

can setTemplateId be used along with SetHtmlBody for the following code?

public EmailMessageWrapper(String fromAddr, Id toAddrId, String sub, Map<String, String> mapSubjectParams, Map<String, String> mapBodyParams) { this(fromAddr, null, toAddrId, null, ...
1
vote
0answers
33 views

Customer Attention email

The email that is sent to a portal user when their case is updated (to Customer Attention) comes from the an employee that updated the case. Can we have it come from noreply@mycompany.com instead? ...
1
vote
0answers
164 views

SingleEmailMessage CC is not working

I'm trying to send emails with TO, CC and BCC addresse mail.setTemplateId(emailTemplateId); mail.setTargetObjectId(emailTargetId); mail.setSenderDisplayName(Label.Sender_Name); mail.setReplyTo(...