Problem/Motivation
After we've implemented 'Reply-To' field in #2824195: Add "Reply-to" field next to the "From" field, we are still missing a check to proof if 'Reply-To' address is identical to 'From' address. In this case, the 'Reply-To' field should not be displayed. Also this case is not covered by our collection of email examples.
Proposed resolution
Do not display 'Reply-To' if it is identical to 'From'.
Add test coverage using plain-text-reply-to.eml replacing the two 'Reply-To' mailboxes with the same 'From' address.
Remaining tasks
User interface changes
API changes
Data model changes
Problem/Motivation
Proposed resolution
Remaining tasks
User interface changes
Before the fix, 'Reply-To' is displayed when it is the same as 'From':
After the fix, 'Reply-To' is NOT displayed when it is the same as 'From':
API changes
Data model changes
Comment | File | Size | Author |
---|---|---|---|
#10 | interdiff-2826672-7-10.txt | 6.39 KB | toncic |
#10 | do_not_display-2826672-10.patch | 4.02 KB | toncic |
| |||
#7 | interdiff-2826672-5-7.txt | 1.74 KB | toncic |
#7 | do_not_display-2826672-7.patch | 4.1 KB | toncic |
| |||
#5 | interdiff-2826672-2-5.txt | 2.88 KB | toncic |
Comments
Comment #2
tduong CreditAttribution: tduong at MD Systems GmbH commentedHere the patch, probably the template filename is too long.
IS updated with screenshots.
Comment #4
miro_dietikerIf it is multiple, we should always list them all. We only want to have it removed if it is single and identical to from.
Comment #5
toncic CreditAttribution: toncic at MD Systems GmbH commentedChanged logic to show the reply-to if there are multiple addresses.
Comment #6
miro_dietikerNeed work since we have the Rfc2822Address now.
I would prefer to always do the foreach loop and later do the check:
if (count($reply_to)==1 && $reply_to[0]['address'] == $from['address'])..
And then unset the element.
Comment #7
toncic CreditAttribution: toncic at MD Systems GmbH commentedImplement comm #6.
Comment #8
mbovan CreditAttribution: mbovan at MD Systems GmbH commentedI think we will always have "From" header in a message. Otherwise, the email message is invalid.
$key
seems not needed.We should not use early return here. That means, no other preprocess code will be executed. Let's add a test to assert it.
Also, we should compare email addresses rather than objects. That prevents the case of different names but same email addresses.
IMO, we should put these tests in the related mail element test -
InmailMessageWebTest
.We have /addresses folder now. What about moving the emails in there?
example.com
Optional: it would be nice to have self-explanatory mail body, mentioning that it contains multiple reply-to addresses etc...
Comment #9
mbovan CreditAttribution: mbovan at MD Systems GmbH commentedUnrelated:
$address->getAddress()
is pretty confusing.As a followup we could think about renaming
Drupal\inmail\MIME\Rfc2822Address::getAddress()
togetEmail()
as it's always an email and more intuitive IMHO.Comment #10
toncic CreditAttribution: toncic at MD Systems GmbH commentedImplemented comm #8. I added in preprocess function break instead of return, break will only finish foreach.
Created follow-up for renaming getAddress().
Comment #12
miro_dietikerCommitted with comment refinements and now additionally preserving all keys in the preprocess.
Comment #14
tduong CreditAttribution: tduong at MD Systems GmbH commentedJust a question: In plain-text-reply-to-multiple.eml the first Reply-To mailbox is the same as From and the second Reply-To mailbox same as To.
What is the goal of this, is it made on purpose ?
Comment #15
tduong CreditAttribution: tduong at MD Systems GmbH commentedDiscussed and fixed it in #2807733: Write mail display tests per example