Skip to main content Take our 5-minute Community Survey. Open now through 4/11/2025. Click here to participate.
I have code which sends emails where i'm trying to control the sending email address.

I'm finding if I set an org wide email address, using setOrgWideEmailAddressId(), messages always go to spam.  If I don't set it they avoid spam but don't come from the desired sender.

Anyone have suggestions of how to control the sender and stay out of spam?

Thanks,

Steve 
1 answer
  1. Nov 25, 2020, 6:24 AM
    HI Steve,

    You might want to set up an SPF record (Sender Policy Framework) on your own domain (the orgwideemail address, which is your company domain).

    When you create an SPF entry against your DNS, you are effectively telling recipients that the named sender (in this case salesforce) is allowed to send mails on behalf of your domain (orgwideemail).

    Reference: https://salesforce.stackexchange.com/questions/13131/avoid-blacklisting-of-org-wide-email-address

    Also check https://developer.salesforce.com/forums/?id=906F0000000D8enIAC

    Hope this helps you. Please mark this answer as best so that others facing the same issue will find this information useful. Thank you
0/9000