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
Lanny KnessLanny Kness 

Can users with Partner Community License send emails from Apex code?

I have users that are in communities and are assigned Partner Community licenses. In their profiles, in the General User Permissions, Send EMails is checked (along with Edit Tasks, Edit Events). THese users access tabs that are Visualforce and Apex controllers. WHen the user performs certain actions (clicks a button), an email is sent out to another user in the community. 

I cannot get this to work. When the users are setup as normal internal users with Salesforce Platform licenses, the emails are sent. 

So can a community user send out email via apex code? If so what have i missed? 

Thanks. 
Best Answer chosen by Lanny Kness
Shashikant SharmaShashikant Sharma
Hi Lanny,

Yes users with Partner Community License send emails from Apex code.

In you apex class make it Without Sharing so if your class name is MyClass then it shouldbe declared like
 
public without sharing class MyClass {


}

It should resolve your issue.

Let me know if you still face issue.

Thanks
Shashikant

 

All Answers

Shashikant SharmaShashikant Sharma
Hi Lanny,

Yes users with Partner Community License send emails from Apex code.

In you apex class make it Without Sharing so if your class name is MyClass then it shouldbe declared like
 
public without sharing class MyClass {


}

It should resolve your issue.

Let me know if you still face issue.

Thanks
Shashikant

 
This was selected as the best answer
Lanny KnessLanny Kness
Thanks! That worked. 
Shashikant SharmaShashikant Sharma
Glad that it worked for you :).

Thanks
Shashikant