Page MenuHomePhabricator

Email sending is broken (or documentation needs a fix)
Closed, ResolvedPublicBUG REPORT

Description

Steps to replicate the issue:

$wgSMTP = [
    'host' => 'tls://smtp-relay.gmail.com',
    'IDHost' => 'wiki.domain.org',
    'port' => 465
];

I am using gmail smtp relay with TLS and IP authentication so those 3 parameters should be sufficient.

What happens?:

Failed to connect to tls://smtp-relay.gmail.com:465 [SMTP: HELO was not accepted (code: -1, response: )]

What should have happened instead?:

Email should be sent correctly.

Software version:

1.35.7 (5c3da73)
11:14, 23 August 2022

Workaround:

Add 'localhost' => 'wiki.domain.org', see bellow:

$wgSMTP = [
    'host' => 'tls://smtp-relay.gmail.com',
    'IDHost' => 'wiki.domain.org',
    'localhost' => 'wiki.domain.org',
    'port' => 465
];

You can add debuging information to see that mediawiki presents the parameter HELO containing localhost instead of the content of IDHost:

$wgSMTP = [
    'host' => 'tls://smtp-relay.gmail.com',
    'IDHost' => 'wiki.domain.org',
    'port' => 465,
    'debug' => true
];

Side note: the https://www.mediawiki.org/wiki/Manual:$wgSMTP documentation contains a 404 link:

Event Timeline

Sending also works with only those parameters:

$wgSMTP = [
    'host' => 'tls://smtp-relay.gmail.com',
    'localhost' => 'wiki.domain.org',
    'port' => 465
];
Aklapper claimed this task.
Aklapper added a project: Documentation.

Thanks! Docs fixed in https://www.mediawiki.org/w/index.php?title=Manual%3A%24wgSMTP&type=revision&diff=5434829&oldid=5434144 (feel free to edit if something is wrong or missing)

Great!
My only doubt is if IDHost is needed but my php skills are to limited to debug this correctly.

Also, I am wondering if the following is accurate:

required by some mail servers

It seems that Pear::mail will not use IDHost but the following:

$params["localhost"] - The value to give when sending EHLO or HELO. Default is localhost

See: https://pear.php.net/manual/en/package.mail.mail.factory.php (thanks for updating the link in the doc BTW!)