Problem/Motivation
The system.site:mail address is a required setting since ages. Still, there is a fallback to ini_get('sendmail_from') in various places.
Steps to reproduce
Proposed resolution
- Remove the
ini_get('sendmail_from')fallback. It doesn't have any benefit. - Do not touch the
PhpMailplugin. Thesendmail_fromini settings is not used as a fallback there.
Remaining tasks
ImplementWrite change recordReview- Commit
User interface changes
Introduced terminology
API changes
Data model changes
Release notes snippet
| Comment | File | Size | Author |
|---|---|---|---|
| #18 | 3579153-remove-sendmail-fallback.patch | 1.96 KB | mehak22 |
| #10 | Get-Started-project-03-15-2026_12_54_PM.png | 79.64 KB | kt2026 |
Issue fork drupal-3579153
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
- 3579153-remove-fallback-to
changes, plain diff MR !15092
Comments
Comment #2
znerol commentedTagging as novice issue. Staying by for reviews.
Comment #3
znerol commentedComment #4
scontzen commentedComment #6
scontzen commentedRemoved the
ini_get('sendmail_from')fallback from four files.Did not touch
PhpMail.phpas stated in the issue summary.There is one remaining mention of
sendmail_fromintesting_site_config.install, just a comment describing the test's intent, not a fallback.Setting to Needs review.
Comment #7
scontzen commentedComment #8
znerol commentedThanks! I'm trying to figure out whether this requires a change record.
Comment #9
znerol commentedAdded a change record. This is good to go. Thanks @scontzen
Comment #10
kt2026 commentedI am a first time contributor who was learning around drupal contribution and issues today, i did not realised that i have a no further action on this issue
Comment #11
kt2026 commentedComment #12
sivaji_ganesh_jojodae commented+1 for the MR.
In the change request would it make sense the add the following?
Comment #13
znerol commentedModules shouldn't actually set the
Fromaddress at all. This is the responsibility ofMailManager. Andsystem.site:mailis a required config value. It's difficult for a site owner to unset/blank it.Comment #14
longwaveIs the fallback worth keeping in the installer form? At that point I think it's possible that it's not set yet, because that's the first time that the choice is offered to the site owner?
Comment #15
znerol commentedI do not think so. Looking at the PHP docs, I have the impression that this setting is only really expected to be in use on windows (because there is no sendmail binary, PHP is forced to use SMTP).
Comment #16
longwaveAdded a suggestion to simplify the code further, and a question too.
Comment #17
mehak22 commentedI reviewed the MR and the recent suggestions from @longwave.
Removing the fallback to ini_get('sendmail_from') looks correct and aligns with the issue goal. I also verified that PhpMail was not modified, as required.
Regarding the suggestion to inline the variable: using `$this->config('system.site')->get('mail')` directly in `#default_value` makes sense and simplifies the code, so I support that change.
On the question of whether to remove the default value entirely: since `system.site:mail` is a required configuration and there are profiles that already set it, keeping it as the default value seems safer for now to avoid any unexpected issues during installation.
Overall, the approach looks good to me 👍
Comment #18
mehak22 commentedApplied suggested changes:
- Removed fallback to sendmail_from ini setting
- Inlined default site mail value as suggested
- Updated outdated comment
Ready for review.
Comment #19
znerol commentedThanks. The patch workflow is outdated. You find docs on how to update an existing merge request here.
Comment #20
znerol commentedComment #21
scontzen commentedApplied the suggested change to inline the variable.
Comment #22
znerol commentedThanks @scontzen.
I'm leaving this on needs review for a little while just in case a novice likes to review this (see the docs).
Comment #23
znerol commentedFeedback from @longwave is addressed, MR comments are resolved, this is good to go.
Comment #24
poker10 commentedRe: #15 - are we sure that the default value in the
SiteConfigureFormdoes not have any benefit for Windows users using for example Apache? If nothing else, at least as a hint? We have not dropped the whole Windows support, just support for IIS on Windows (see: #3358248: [policy, no patch] Drop support for IIS in Drupal 11). Windows with Apache/Nginx is still supported and also mentioned here: https://www.drupal.org/docs/getting-started/system-requirements/web-serv... .The
\Drupal\Core\Mail\Plugin\Mail\PhpMailplugin is also using the directive, see: https://git.drupalcode.org/project/drupal/-/blob/main/core/lib/Drupal/Co... , but yes, it is for a different purpose.I looked when this default value was added to the
SiteConfigureFormor other places , to check if there was any explicit explanation, but have not found a specific mention about it in issues. Relevant commits were https://git.drupalcode.org/project/drupal/-/commit/258c653f56ce7dd7dddcb... and https://git.drupalcode.org/project/drupal/-/commit/64c1b5f1106136964cfb3... .That said, I am not sure if we should remove it in the installer - if yes, then I think it would probably be beneficial to add some additional explanation for Windows users to the CR.
Moving to NR based on these. Thanks!
Comment #25
znerol commentedRemoving the novice tag. I do not see any obvious next step here which could be performed by a novice developer / reviewer.
Comment #26
znerol commented#24 is basically the same question as #14. My answer in #15 was clearly too terse. So please allow me to try again.
It would be clearly beneficial to keep the default value in the installer if the
sendmail_fromini setting contains a useful value in many cases.On the other hand it would be clearly beneficial to remove the default value in the installer if the
sendmail_fromini setting contains a bogus value in many cases.I expect that the
sendmail_fromini setting is empty for almost everybody. There is a slight chance that thesendmail_fromini is set to some value in some special environments.One of those environments could be a windows box where somebody had to configure it for a different preexisting PHP application which relies on the PHP mail() function exclusively.
Another environment could be some hosting provider / platform which sets the
sendmail_fromini value to some half way sane default value. I tried to asses whether that could be the case, but only found a vague mention in Plesk docs. I think that Drupal centric PaaS/SaaS providers tend to inject config on the application level - not the ini level.To conclude, there is no really strong reason to keep it and there is no really strong reason to remove it. The default value is neither beneficial nor is it bogus. Neither for unix nor for windows users.
For consistency reasons, I'd still prefer to remove it. If other people think that there is a benefit to keep it, then I'm okay with that too.
Comment #27
znerol commentedI guess no answer means no objections?
Comment #28
dries commentedI reviewed this and it looks great to me. 👍
Comment #30
longwaveCommitted and pushed 9a04a208991 to main. Thanks!
The CR only mentions 12.0, this is an unlikely codepath and just a cleanup so not sure it's worth backporting.