Page MenuHomePhabricator

Sendmail not working. mail() function required in wikibase docker image
Closed, ResolvedPublic

Description

I am trying to set up QuickStatements for the container.
That requires adding an OAuth consumer via [[Special:OAuthConsumerRegistration]].
That requires confirming my email as admin.
That requires sending me a confirmation email via [[Special:ChangeEmail]].
That fails with Unknown error in PHP's mail() function.

Requests:

  • Alter container to automatically allow sending of email
  • Let me know how to alter the one I have to allow sending mail (already did apt-get install sendmail but no joy)

Event Timeline

Restricted Application added a subscriber: Aklapper. · View Herald Transcript

Addendum: Also added $wgEnableEmail=true; to LocalSettings.php, no joy.

Addshore renamed this task from Sendmail not working to Sendmail not working. mail() function required in wikibase docker image.Oct 9 2018, 7:15 PM
Addshore added a subscriber: Tarrow.
Addshore added a subscriber: Addshore.

As we use the mediawiki docker image I guess mail should actually be installed for that.

So should this be done in the wikibase Dockerfile then? If you could give me some pointers, I could give it a try.

FYI, with latest master I naïvely tried

$wgEnableEmail = true;

$wgSMTP = [
	'host'     => "some_host", // mail server host
	'IDHost'   => "some_sender", // domain name
	'port'     => 25,                 // SMTP port
	'auth'     => false,               // SMTP authentication?
	# 'username' => "my_user_name",     // Username for SMTP authentication
	# 'password' => "my_password"       // Password for SMTP authentication
];

on a non-auth mail relay and that worked alright.

Yup, that doesn't require the mail function :)

So should this be done in the wikibase Dockerfile then? If you could give me some pointers, I could give it a try.

Yes

Specifically for the wikibase image we already turn on at least one extension
https://github.com/wmde/wikibase-docker/blob/master/wikibase/1.33/base/Dockerfile#L31
Mail is part of another we would need.
This could also be done in the Dockerfile for each current tag of the wikibase image (all found in that repo)

It might make sense for this to be included in the MediaWiki image too, which our images are based on, could file another ticket for that.

Yup, that doesn't require the mail function :)

I just followed the steps from OP

...
That requires sending me a confirmation email via [[Special:ChangeEmail]].
That fails with Unknown error in PHP's mail() function.

and I figured that this did not fail for me because I configured it as in https://phabricator.wikimedia.org/T206517#5559725.
Just curious: Why does it not require the mail function (and what is the wgSMTP and wgEnableEmail settings for)?

In https://www.mediawiki.org/wiki/Manual:$wgSMTP#Details

I see

This setting requires PEAR's Mail package to be installed (run pear install MAIL Net_SMTP, and you can run pear list to confirm). Since MediaWiki 1.27 (git #a372e170), the required PEAR dependencies are already bundled. If you get an error message stating that pear is not installed, then install php-pear and then try again. It may also cause conflicts if you have different versions of those PEAR packages installed on your system. In that case, you can remove the installed ones with the command pear uninstall mail pear/Auth_SASL net_smtp
You may also install pear/mail with Composer with the command:

composer require pear/mail

The key bit being since 1.27 the pear deps are bundled.

So, if in T206517#5559725 you were trying with the docker images then there might not be anything to do here, but that should be checked.

Ah, thanks for pointer and reference.

So, if in T206517#5559725 you were trying with the docker images then there might not be anything to do here, but that should be checked.

Yep, confirmed, I tried with the docker images, specifically MW 1.33.

Addshore claimed this task.