How to disable and enable the email function in MediaWiki
By default, in MediaWiki the email function is enabled. The application sends automatically emails for specific purposes. For example, all the different notifications: e.g. password reminders, watchlist notifications, user talk page notifications, etc. On the site there's also a form for sending emails with which users can send email messages to other users. There are options in the account preferences of registered users with which they can enable and disable different aspects related to email and email notifications. What options are available in the account preferences depends on the variables that are enabled in the LocalSettings.php file of your MediaWiki.
In this article we'll show you how to completely disable (and enable again) the email function and also how to disable and enable only the function for sending emails to other users. Both things are done by modifying the LocalSettings.php file.
- To completely disable the email function and all related options find the option $wgEnableEmail in LocalSettings.php and set it to false:
$wgEnableEmail = false;
This will disable all email messages and notifications that are automatically sent by the application. It will remove all the options related to email in the user preferences of registered users; it will make inaccessible the form on the site for sending emails, and it will also remove the email field from the form for creating new user accounts. Regardless of how the other email options are set up in the LocalSetting.php file, when this one is disabled they will be inactive. To enable the email function simply replace false with true.
- In case you only want to disable the form for sending emails to other users, so that registered users can't send messages from the site to other users, find the option $wgEnableUserEmail in LocalSettings.php and set it to false:
$wgEnableUserEmail = false;
This will only make the site form for sending emails inaccessible. It's the form that can be used to send messages to other registered users. Everything else related to emails will function. The email options (the ones that are not related to emailing other users) will be available and the notifications that are automatically sent by the application will function.
The LocalSettings.php file is in the root MediaWiki folder on your hosting account. If, for example, the application is installed directly in the public_html directory on your MediaWiki hosting account, then the path to the file on the account will be public_html/LocalSettings.php. HostKnox customers can modify files directly on the account from the Files section of the Pixie control panel. Another way to edit the file is to download it on your local computer, edit it with a text editor (e.g. Notepad) and upload it back overwriting the old file. It can also be done via SSH.
Other articles related to the email function:
Was this answer helpful?
- How to enable password resets based on the username or email address of users in MediaWiki
- How to limit the sitemap to specific namespaces in MediaWiki
- How to disable and enable user account creation in MediaWiki
- How to enable and disable email authentication in MediaWiki
- How to disable and enable the function for storing uploaded files in subfolders in MediaWiki