Configuring MediaWiki for SMTP

From eddynetweb's cesspit
Revision as of 16:14, 6 March 2017 by Eddynetweb (talk | contribs) (Information regarding MediaWiki added.)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Configuring SMTP support on MediaWiki is actually quite easy!

Prerequisites

Make sure that you have php-pear installed first (for any version, really):

apt-get install php-pear

Then make sure the following dependencies are installed (through php-pear):

pear install mail
pear install Net_SMTP
pear install Auth_SASL
pear install mail_mime

Finally, restart apache2:

service apache2 restart

Configuration

Now, go into the MediaWiki root directory and look for your LocalSettings.php, and add the following array:

 $wgSMTP = array(
    'host'     => "mail.example.com", // could also be an IP address. Where the SMTP server is located
    'IDHost'   => "example.com",      // Generally this will be the domain name of your website (aka mywiki.org)
    'port'     => 25,                 // Port to use when connecting to the SMTP server
    'auth'     => true,               // Should we use SMTP authentication (true or false)
    'username' => "my_user_name",     // Username to use for SMTP authentication (if being used)
    'password' => "my_password"       // Password to use for SMTP authentication (if being used)
);

Follow the comments directions and you should be good to go! Keep in mind that you might have to review firewall entries and other things if you have issues.