function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Michael MMichael M 

Why is apex to send email only running when I run it, but not other users?

Hello, I have a VF page that has a commandbutton that triggers an action to send an email. I am testing this in sandbox, and it works whenever I click the button, but if I login as another user, it does not work. There is no error message displayed, it just simply does not work. Why would that be? 
Best Answer chosen by Michael M
Michael MMichael M
Hi Vinay, They have the permission. I think i realized what it is-- when I login as an administrator into another user, it doesn't work. But if I completely logout, then login to Salesforce as another user, then it works. I guess it doesn't let administartors email as other users?

All Answers

VinayVinay (Salesforce Developers) 
Hi Michael,

Can you check if 'Send Email' is enabled on profile?

Thanks,
Michael MMichael M
Hi Vinay, They have the permission. I think i realized what it is-- when I login as an administrator into another user, it doesn't work. But if I completely logout, then login to Salesforce as another user, then it works. I guess it doesn't let administartors email as other users?
This was selected as the best answer