We are sending the email using trigger whenever a new discussion is posted in Idea object. We want to change the name in from field

Original format: noreply@salesforce.com on behalf of SFDC Technical Discussion [test@test.com]

Required format: SFDC Technical Discussion [noreply@salesforce.com]

Template Snapshot:

enter image description here

Email Snapshot:

enter image description here

Is there any possible solution for changing from field by keeping from email address as noreply@salesforce.com but change sender name?

Note: Changing email address and removing "behalf of" part will remove email from noreply@salesforce.com, we want to keep noreply@salesforce.com as sender and remove rest of the part and change the sender name.

  • 1
  • @Rob : Hi Rob.... I do not have to remove it. Instead I have to modify it to something like SFDC Technical Discussion <noreply@salesforce.com> . How can this be achieved ? – Ruchi Sep 15 '15 at 10:33
  • Can you not set up a no-reply email address on your own domain? You won't be able to change the 'name' of the SF no-reply address. – Nick Cook Sep 15 '15 at 10:58
  • @NickCook : I dont think my client wants to setup a no-reply for there domain. Still I will confirm from them. If there is any possible workaround then please let me know. And also please let me know any reference where it is provided that we cannot change the name so that I can show it to my client. Thanks – Ruchi Sep 15 '15 at 11:16

Probably it is best to set up a (verified) organization wide email address first. See https://help.salesforce.com/apex/HTViewHelpDoc?id=orgwide_email.htm

Then, assuming you use Apex to send the email, use that sender in your Trigger using someEmailMessage.setOrgWideEmailAddressId(orgWideEmailId); See https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_classes_email_outbound_single.htm#apex_Messaging_SingleEmailMessage_setOrgWideEmailAddressId

Note that you probably want to store the Org Wide EmailAddress Id in a Custom Setting, so you don't have to hardcode it in your Apex code; hardcoding it would be bad for changes later, but also bad for testing in Sandboxes and deploying to Production etc.

Create e.g. a Custom Setting with name Email_Settings__c and field Common_Org_Wide_Email_Address_Id__c and then in your Apex, you would go something like this:

// Get custom Settings
Email_Settings__c customSettings = Email_Settings__c.getAll().values().get(0);
String orgWideEmailAddressId = customSettings.Common_Org_Wide_Email_Address_Id__c;

// Create email and set org Wide Email Address Id
Messaging.SingleEmailMessage someMail = new Messaging.SingleEmailMessage();
  • Hi willem...thanks for your suggestion . I will discuss this with my clients and see what is the possible best solution. – Ruchi Sep 15 '15 at 15:45
  • 1
    Good luck. And you'll probably want to store that Org Wide Email Address Id in a Custom Setting, so you can change it later without modifying the code. I'll add that to the answer. – Willem Mulder Sep 16 '15 at 7:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.