I'm trying to stop the email notifications to a community User through APEX code for the following scenarios:

  1. Welcome email for a New User creation
  2. Email notification on receiving a Private message.

I have used the following code to disable the Email notification:

userId.UserPreferencesDisableAllFeedsEmail = true;

Even then the emails are thrown to the user.
Please suggest some workaround for this.

  • I was just asking about this the other day...not a solution here but some thoughts. May 5, 2015 at 0:47

2 Answers 2


did you tried "email --> Welcome New Member" check box option available on configuration page ? From there you can disable welcome email. There is any specific use case to do this using Apex code ?

  • I don't want to change the Configuration for this. I need to stop the email notifications only for the users who are created by me through the APEX code.
    – Naveen
    Sep 5, 2014 at 9:38
  • Did you find an answer? I need to create over 2 million accounts and neither want to do them manually OR have them receive welcome emails.
    – tggagne
    Jan 22, 2015 at 17:26
  • @tggagne - follow the advice listed here to avoid having them all go out when you enable the Welcome Message. May 5, 2015 at 0:49
  1. Disable the Welcome Message
  2. Add a flag to your user records when you create them in APEX
  3. Add a workflow rule that fires when the new user record is created to send the notification

You must log in to answer this question.

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