You need to sign in to do that
Don't have an account?

Batch job sends email with the sender email address of user who started the job and not the desired one
Hi all,
I see that even if you set who is the Sender in your email using an email batch job, you will get an email with the sender format:
<noreply.salesforce.com> on behalf of <email address of user who started the job>
I don't wish this to appear, even if I uncheck the Email Compliance ID checkbox via Email Administration --> Deliverability I get the wrong sender, that means, the email address of the user who started the batch job.
Now I was trying to use a similiar part of code like this:
after adding an organization wide address and using the sender email address for this. But after starting the batch job, this is still sending me an email where the sender email address is the one of the user who started the job and not the given to the owa Variable in the code.
Is there a way or trick to handle this?
I see that even if you set who is the Sender in your email using an email batch job, you will get an email with the sender format:
<noreply.salesforce.com> on behalf of <email address of user who started the job>
I don't wish this to appear, even if I uncheck the Email Compliance ID checkbox via Email Administration --> Deliverability I get the wrong sender, that means, the email address of the user who started the batch job.
Now I was trying to use a similiar part of code like this:
// Use Organization Wide Address for(OrgWideEmailAddress owa : [select id, Address, DisplayName from OrgWideEmailAddress]) { if(owa.Address.contains('CSR')) email.setOrgWideEmailAddressId(owa.id); }
after adding an organization wide address and using the sender email address for this. But after starting the batch job, this is still sending me an email where the sender email address is the one of the user who started the job and not the given to the owa Variable in the code.
Is there a way or trick to handle this?
Can you try to set setReplyTo and setSenderDisplayName? Can you share code to see the issue

Thanks Raj, but I have already tried and I am still receiving an email with the email address of the user who started the job as sender.