Am 18.11.2013, 11:38 Uhr, schrieb Daniel Friesen daniel@nadir-seen-fire.com:
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?
No, I didn't. It says: "This setting requires PEAR's Mail package to be installed [..]" and your response seems to direct me to _not_ use PEAR-Mail.
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.
Thank you!
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.
I'm not sure, if I understood your answer on c. I havent worked with Composer or MediaWiki code-wise yet. Composer is a dependency-management tool, which allows to package components (e.g. PhpMailer) as extension? Will the extension be the "AlternateUsermailer" hook, bundled with dependency on PhpMailer?
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/]
So far, thank you for your answers :) Matthias