No Code Attached Yet bug
avatar vicn1222
vicn1222
26 Oct 2023

Steps to reproduce the issue

Install Joomla as default.
Global Configuration -> Server -> Mailer = "PHP Mail".

"Forgot your password" unable to send email.

Expected result

Email should be sent

Actual result

No email is sent

System information (as much as possible)

Joomla 5.0
Red Hat RHEL 9

Additional comments

The cause

In file libraries/src/Mail/MailerFactory.php, line 83

 if ($mailer->setFrom($mailfrom, MailHelper::cleanLine($fromname), false) === false) {

needs to be changed to

 if ($mailer->setFrom($mailfrom, MailHelper::cleanLine($fromname), true) === false) {

The php "mail" needs $additional_params = "-fsupport@mydomain.com"

mail(
    string $to,
    string $subject,
    string $message,
    array|string $additional_headers = [],
    string $additional_params = ""
): bool
avatar vicn1222 vicn1222 - open - 26 Oct 2023
avatar vicn1222 vicn1222 - change - 26 Oct 2023
Labels Removed: ?
avatar joomla-cms-bot joomla-cms-bot - change - 26 Oct 2023
Labels Added: No Code Attached Yet
avatar joomla-cms-bot joomla-cms-bot - labeled - 26 Oct 2023
avatar vicn1222
vicn1222 - comment - 26 Oct 2023

Looking at the maillog, without the $additional_params = "-fsupport@mydomain.com", the sender email becomes

from=apache@T140.localdomain

Oct 26 14:47:52 T140 postfix/qmgr[1679]: 4A0FE803386F4: from=<apache@T140.localdomain>, size=957, nrcpt=1 (queue active)

The email is then rejected by gmail-smtp-in.l.google.com with message

This mail has been blocked because the sender is unauthenticated. 550-5.7.26 Gmail requires all senders to authenticate with either SPF or DKIM. 550-5.7.26  550-5.7.26  Authentication results: 550-5.7.26  DKIM = did not pass 550-5.7.26  SPF [t140.localdomain]

This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/42222.
avatar Hackwar Hackwar - change - 27 Mar 2024
Labels Added: bug
avatar Hackwar Hackwar - labeled - 27 Mar 2024
avatar chmst chmst - change - 25 Nov 2024
Status New Closed
Closed_Date 0000-00-00 00:00:00 2024-11-25 10:26:21
Closed_By chmst
avatar chmst chmst - close - 25 Nov 2024
avatar chmst
chmst - comment - 25 Nov 2024

Closing as this is not a joomla core. https://support.google.com/mail/thread/210192174/how-to-authenticate-dkim-or-spf?hl=en
Maybe you can ask for support on https://forum.joomla.org

avatar HLeithner
HLeithner - comment - 25 Nov 2024

As Christiane mentioned, this is not a Joomla issue, anyway please don't use php mail function, use smtp instead.

avatar pe7er
pe7er - comment - 26 Nov 2024

As Christiane mentioned, this is not a Joomla issue, anyway please don't use php mail function, use smtp instead.

The reason to use SMTP is that your SMTP server (if configured correctly) adds a DKIM signature to your outgoing emails.
Gmail requires all senders to authenticate with either SPF or DKIM.
The PHP mail and sendmail methods don't add a DKIM signature.

Add a Comment

Login with GitHub to post a comment