I configured $wgSMTP in LocalSettings.php, but password resets just weren’t working…

Posted in Linux

I had $wgSMTP set up to talk to a remote exchange server, but password resets just weren’t working from the wiki.

It turns out all I was missing was the php-pear-Mail package (in fedora, for debian or other systems it may be a different package name). I started by checking any logs related to this problem…

In the system mail log

/var/log/maillog

You might find that it’s not attempting to use a remote mail system at all. I wanted it to relay mail through another server on the same network. Here I find it’s just sending mail locally, and it’s piling up in /var/spool/mail/

localhost sendmail[2870]: n2cN80: from=<lighttpd@localhost.localdomain>, size=926
proto=ESMTP, daemon=MTA, relay=localhost.localdomain [127.0.0.1]
relay=[127.0.0.1], dsn=2.0.0, stat=Sent (n2cN80 Message accepted for delivery)

mediawiki’s LocalSettings.php

$wgSMTP

I checked and made sure $wgSMTP was setup right. If you don’t need to authenticate, you don’t need ‘auth’, ‘username’, or ‘password’ at all.

$wgSMTP = array(
 'host'   => "mailserver.mydomain.com",
 'IDhost' => "hello.its.me",
 'port'   => "25"
 'auth'   => "true",
 'username' => "frickin",
 'password' => "sharkswlaserbeams"
);

$IP

I also made sure I changed the $IP variable when I moved /usr/share/mediawiki to another directory. If you moved it but didnt set $IP in LocalSettings.php, then it might break because the php files in the /includes directory will still end up looking at the old include_path.

in lighttpd’s error log

/var/log/lighttpd/error.log

I could see this message every time the wiki would attempt to send email.

2009-03-11 12:46:00: (mod_fastcgi.c.2618) FastCGI-stderr: PHP Warning:  UserMailer::require_once(Mail.php) [<a href='usermailer.require-once'>
...failed to open stream: No such file or directory in /usr/share/mediawiki/includes/UserMailer.php on line 119

I looked at UserMailer.php on line 119 and found it was looking for Mail.php, but there was not a Mail.php anywhere to be found. What? A missing dependency in Linux!? The horror… ok easy fix.

PEAR’s Mail package

Currently supported backends include: PHP’s native mail() function, sendmail, and SMTP.

If you have $wgSMTP set up properly, check to see if you have the PEAR mail package installed.
$ sudo yum install php-pear-Mail

Mar 11 12:47:30 localhost yum: Installed: 1:php-pear-1.7.2-2.fc10.noarch
Mar 11 12:47:31 localhost yum: Installed: php-pear-Net-Socket-1.0.9-1.fc10.noarch
Mar 11 12:47:32 localhost yum: Installed: php-pear-Auth-SASL-1.0.2-4.fc6.noarch
Mar 11 12:47:32 localhost yum: Installed: php-pear-Net-SMTP-1.3.2-1.fc10.noarch
Mar 11 12:47:32 localhost yum: Installed: php-pear-Mail-1.1.14-2.fc8.noarch

ta-da.

Helpful mediawiki sites:
* http://www.mediawiki.org/wiki/MediaWiki
* http://shrubbery.mynetgear.net/wiki/Main_Page

Posted by admica   @   11 March 2009

Related Posts

0 Comments

No comments yet. Be the first to leave a comment !
Leave a Comment

Name

Email

Website

Previous Post
« Control the links that appear in Mediawiki’s toolbox and make it vanish for anonymous users
Next Post
How to Delete Accounts from Any Website, guaranteed! »
Powered by Wordpress   |   Lunated designed by ZenVerse