1

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: [email protected] on behalf of SFDC Technical Discussion [[email protected]]

Required format: SFDC Technical Discussion [[email protected]]

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 [email protected] but change sender name?

Note: Changing email address and removing "behalf of" part will remove email from [email protected], we want to keep [email protected] as sender and remove rest of the part and change the sender name.

4
  • 1
    See salesforce.stackexchange.com/questions/28797/…
    – Rob
    Commented Sep 15, 2015 at 10:03
  • @Rob : Hi Rob.... I do not have to remove it. Instead I have to modify it to something like SFDC Technical Discussion <[email protected]> . How can this be achieved ?
    – Ruchi
    Commented Sep 15, 2015 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 C
    Commented Sep 15, 2015 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
    Commented Sep 15, 2015 at 11:16

1 Answer 1

1

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();
someMail.setOrgWideEmailAddressId(orgWideEmailAddressId);
2
  • Hi willem...thanks for your suggestion . I will discuss this with my clients and see what is the possible best solution.
    – Ruchi
    Commented Sep 15, 2015 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. Commented Sep 16, 2015 at 7:38

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .