Closed (fixed)
Project:
Drupal core
Version:
11.x-dev
Component:
mail system
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Issue tags:
Reporter:
Created:
28 Oct 2023 at 09:30 UTC
Updated:
30 Mar 2026 at 13:34 UTC
Jump to comment: Most recent
Comments
Comment #2
znerol commentedPostponed on #3379794: Add symfony mailer transports to Dependency Injection Container (mail delivery layer)
Comment #3
znerol commentedComment #4
adamps commentedGreat, this seems like a very thorough and precise treatment of these two headers - although I didn't check the standards myself to confirm correctness.
Message::getPreparedHeaders()has code that overlaps/conflicts with this issue (I'm looking at v6.4.17). It will set from based on sender so potentially we don't needsetDefaultFrom(). And it will set sender based on from, which will undo the work ofremoveRedundantSender().I'm adjusted the terminology in the title/IS slightly. Emails will pass through the transport layer, but they aren't sent directly to it as there are other layers on top (including delivery and likely another Drupal-specific one that we create).
I see this as a part of #3530860: Create a new mailer service to wrap symfony mailer - it's one of the things that should be done as part of building every email. There is similar, but simpler code in
MailManager. We could agree to create some Drupal-specific email events, in which case this should be adjusted to use them. So I feel that "postponed" is the correct status for a couple of weeks more.@znerol How does that all sound to you?
Comment #5
znerol commentedInteresting idea. I tested that. The very first test fails at line 55 (last assertion in the following snipped).
The test expects that
$originalEmail->getFrom()contains the site address. This isn't the case, becauseMessage::getPreparedHeaders()does only derive, but not save the from header.However, imagine a message subscriber which logs messages which failed. This might want to log the from header as well.
That is not true.
removeRedundantSender()only removes sender if there are multiple from addresses.Message::getPreparedHeaders()only adds sender when there is none and when there are multiple from addresses.Regarding the process, nothing blocks this. Even if the implementation should change at some point, its good to have the tests in place. And I guess it will take some time and energy to review them as well.
Comment #6
znerol commentedComment #7
smustgrave commentedDidn't see any MR to review?
Comment #9
znerol commentedComment #10
smustgrave commentedCan we clean up the summary some please. Proposed solution is blank.
Comment #11
znerol commentedComment #12
znerol commentedComment #13
smustgrave commentedThis looks really good. Can we get a CR for the new subscriber for others to use
Comment #14
znerol commentedNote to self: add a section to the existing mailer module CR.
Comment #15
znerol commentedUpdated the existing CR.
Comment #16
smustgrave commentedCR entry LGTM.
Comment #17
imclean commentedIn the CR example "For authenticated SMTP", what is the default port? Should this be mentioned somewhere?
Comment #18
znerol commentedInteresting question. There is not one default port but two (25 for SMTP and 465 for SMTPS). This is analogous to HTTP (port 80) and HTTPS (port 443). My recommendation would be to just leave out the port unless its a custom one (e.g., most useful example is mailpit). Although, some mail providers require port 587 to send out authenticated mail and only allow port 25 for incoming messages only.
That said, I do not think that the CR should go into these kind details. Imagine we'd be replacing guzzle with some other HTTP client library. Would you expect the CR to discuss port numbers?
Comment #19
imclean commentedIn the first instance this sets TLS to true if the port is set to 465 (or port is 0 and openssl is present);
It then sets the port to 465 if TLS is true and port is 0. I guess they cover different situations, where a port of 0 autoselects the port based on whether TLS is set or not.
Can TLS be specified in the transport configuration?
Comment #20
znerol commentedThere is a config schema for mailer_dsn. The use of TLS depends on the options. The options correspond directly with the ones provided by the Symfony Mailer component.
I expect that we will add a proper admin UI for transport configuration before the new mailer in Drupal gets stable.
Comment #21
longwaveCommitted and pushed 7b7712f0891 to main and bfc8c953690 to 11.x. Thanks!
Comment #27
rodrigoaguileraIs there an issue for non-symfony mails that have an incorrect `Sender` header currently in Drupal 11.3.5?
Comment #28
znerol commentedMaybe this one: #3055296: Setting the "Return-Path" header doesn't follow RFC 5321