Manual:$wgSMTP/Gmail
This page provides an example for setting the $wgSMTP
configuration parameter if you would like to use Gmail for sending emails by your wiki.
$wgSMTP = [
'host' => 'ssl://smtp.gmail.com', // hostname of the email server
'IDHost' => 'your-wiki-name.com',
'port' => 465,
'username' => 'myemail@gmail.com', // user of the email account
'password' => '****************', // app password of the email account
'auth' => true
];
You will need to generate an application password for your instance of Mediawiki in your Google account's security preferences. Google discourages app passwords as insecure, but it's the only choice for non-interactive authentication with Google. So, you first have to enable two-factor authentication on your Gmail account. Then you can create an app password in your Google account, and use that in the password setting shown above.