On 2013-11-18 1:07 AM, Matthias Paul wrote:
I'm trying to install a MediaWiki instance. Although I never worked with MediaWiki before, I feel quite comfortable with server issues (*nix) and PHP.
I'd like to have mail support in the MW instance. Unfortunately I cannot rely on sendmail (or even mini_sendmail) binary in my installation for several reasons - both requiring a shell binary. It seems, it's possible to replace original PHP's mail() command by an alternate mailer program.
Have you tried using $wgSMTP?
a) Is includes/UserMailer.php the main and only spot where mail functionality code can be spotted?
It should be. A quick ack/grep doesn't show anything else.
b) I read about hooks in mailer class code (line 288 of https://doc.wikimedia.org/mediawiki-core/master/php/html/UserMailer_8php_sou...): $ret = wfRunHooks( 'AlternateUserMailer', array( $headers, $to, $from, $subject, $body ) ); Is this hook meant to replace the original mail program?
Yes that hook allows an extension to override the mail()/PEAR::Mail handling and implement an alternative mailer backend.
c) Did anyone replace original mailing code by PHPMailer yet?
Not that I know of. But it would be a nice project. PHPMailer is pretty nice, it's even in composer too. Which makes me a little happy, while also reminding me that someone has made a "feature" our lack of a composer.json file – which we could otherwise have put a PHPMailer into, incorporated composer into the release process depending on libraries directly, and not having to go and shove a big blob of 3rd party code into our codebase with absolutely no handling for when it becomes outdated.
d) Or is it easier to just use PEAR::Mail instead of PHPMailer (there seemed to be some code about PEAR in it)?
Nah it's just another part of MW that is legacy code with a bit of NIH sprinkled on it.
Thank you for reading, Matthias
~Daniel Friesen (Dantman, Nadir-Seen-Fire) [http://danielfriesen.name/]