You need to sign in to do that
Don't have an account?
Sending Email from Apex and specifying sent from email
We are using Question and Answers in our customer portal and would like email notifications similar to Salesforce Success' question/answer boards.
I was able to create a trigger that would send email to the clients involved in the discussion whenever a new reply/answer was added however the only issue I am having is that the email is sent on behalf of the client that posted the reply/answer.
In outlook it appears like this:
noreply@salesforce.com; on behalf of; Customer Portal <client@clientcompany.com>
I do not wish to expose our clients email address to each other, is there a way to send emails from apex code using the same on behalf of every time such as noreply@mycompany.com?
Thanks,
Jimmy
You can use an Org wide email address to solve this.
In apex you can use the method mailObj.setOrgWideEmailAddressID(orgWideAddressRecordID)
All Answers
Salesforce.com uses the "on-behalf' email header to reduce the likelihood of email bounces, spam flags, and/or failed deliveries due to SPF, DKIM, or DomainKeys checks; since the emails are sent from a salesforce.com IP address, using noreply@salesforce.com as the proxy sender reduces the spam flag score.
You can use an Org wide email address to solve this.
In apex you can use the method mailObj.setOrgWideEmailAddressID(orgWideAddressRecordID)
Thank you Jerun, that appears to have worked.
It looks like I will have to give the portal profile access to the org wide address, is there any thing I should be concerned about when doing this?
If the portal user doesn't have access to the org wide address they receive this:
INSUFFICIENT_ACCESS_OR_READONLY, Not profiled to access this Org-wide Email Address
and are unable to post a reply.