Configure SMTP for outbound emails
NOTE: We are in the process of modifying the file structure and configuration for many Bitnami stacks. On account of these changes, the file paths stated in this guide may change depending on whether your Bitnami stack uses native Linux system packages (Approach A), or if it is a self-contained installation (Approach B). To identify your Bitnami installation type and what approach to follow, run the command below:
$ test ! -f "/opt/bitnami/common/bin/openssl" && echo "Approach A: Using system packages." || echo "Approach B: Self-contained installation."
The output of the command indicates which approach (A or B) is used by the installation, and will allow you to identify the paths, configuration and commands to use in this guide. Refer to the FAQ for more information on these changes.
Follow these steps:
Install two PEAR packages: Mail and Net_SMTP. Go to the console and run the following command.
$ sudo pear install mail $ sudo pear install net_smtp
Add the following code to the end of the MediaWiki configuration file according to your SMTP server settings. This example shows how to configure it using a Gmail account. Replace USERNAME and PASSWORD with your Gmail account username and password respectively.
NOTE: Depending on your installation type, the MediaWiki configuration file can be found in the following locations:
Approach A (Bitnami installations using system packages): /opt/bitnami/mediawiki/LocalSettings.php
Approach B (Self-contained Bitnami installations): /opt/bitnami/apps/mediawiki/htdocs/LocalSettings.php
$wgSMTP = array( 'host' => 'ssl://smtp.gmail.com', 'IDHost' => 'gmail.com', 'port' => 465, 'username' => 'USERNAME@gmail.com', 'password' => 'PASSWORD', 'auth' => true );
Restart the servers.
To configure the application to use other third-party SMTP services for outgoing email, such as SendGrid, refer to the FAQ.
NOTE: If you are using Gmail as the outbound email server, your application’s attempts to send outgoing emails may be blocked by Gmail if it considers the authentication attempts to be suspicious. When this happens, you will receive a Gmail security alert at the corresponding Gmail address. To proceed, you will need to manually confirm the validity of the authentication attempt before Gmail will permit the application to send outbound emails. For more information on this and other Gmail issues related to outbound email from your application, refer to our Gmail SMTP troubleshooting page.