Open Bug 170823 Opened 22 years ago Updated 2 years ago

Cannot compose to mailing list if list name (alias) contains 2 or more spaces (because TB trims whitespace in display name when sending, then fails to expand the mailing list)

Categories

(MailNews Core :: Composition, defect)

defect

Tracking

(Not tracked)

People

(Reporter: shanmu, Unassigned)

References

Details

(Keywords: good-first-bug)

User-Agent:       Mozilla/5.0 (X11; U; OSF1 alpha; en-US; rv:1.0.1) Gecko/20020917
Build Identifier: Mozilla/5.0 (X11; U; OSF1 alpha; en-US; rv:1.0.1) Gecko/20020917

If I create an alias for a list of addresses with two words, with two spaced in
between those two words, Mozilla interpret the alias name as an email address.
This results in the failiure of delivery. The mail returns back.

Reproducible: Always

Steps to Reproduce:
1. Create an alias for a list of email addresses.Select
   the address book -> New List.
2 Create a new list by name "My  list" (Two spaces between the words
"My" and "list")
3. Select  Compose -> Address from the mail window
4. Select the alias "My  list" from the list of addresses.
(I had my own addresses in this list)

I see the following in the "To" field 

New list <"New  list">

5. Now send the mail.
It will fail.

 
The interesting part is if I create a mail list with one space between
the words it works great.
Actual Results:  
In my case the mail returned back with the following explanation

 Recipient: <Newlist@netscape.com>
 Reason:    5.1.1 <Newlist@netscape.com>... User unknown

Expected Results:  
The mailer should have known that this is an alias and not an email address.
The mail should have been delivered.
The routine msg_parse_Header_addresses in the file 
./mailnews/mime/src/nsMsgHeaderParser.cpp deletes the one extra space in the
mail alias intentionally. This is ok for a email address but should we do this
for Mail aliases also?

I find this in line number 634 of ./mailnews/mime/src/nsMsgHeaderParser.cpp

            if (nsCRT::IsAsciiSpace(*s) && name_out > name_start && nsCRT::IsAsc
iiSpace(name_out[-1]))
              /* collapse consecutive whitespace */;
              
              So if there are two spaces in the mail alias name (between word)
this code will trim one space. Having lost one space it is not going to be
a valid alias name. So the failiure.
	We should avoid doing this parsing if the list is a alias name.
Product: Browser → Seamonkey
Reproducible with Mozilla 1.8b1, with SeaMonkey/20050828 I get a dialog that
starts with 'My list <"My list"> is not a valid e-mail address ...' when I try
to send the mail.
fails in both TB version 1.5 (20051025) and suite
Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9a1) Gecko/20051128 SeaMonkey/1.5a
Assignee: racham → nobody
Status: UNCONFIRMED → NEW
Component: Address Book → MailNews: Composition
Ever confirmed: true
OS: Other → All
Product: Mozilla Application Suite → Core
QA Contact: nbaca
Hardware: Other → All
Summary: Address book misinterprets the spaces between the alias name. → Address book misinterprets if more than one space in alias name.
QA Contact: composition
Product: Core → MailNews Core
Confirming for TB 31.6.0.
Joshua, can you comment?

Looks like trimming of whitespace in display names when sending (which is arguably a reasonable thing to do) breaks mailing list functionality if mailing list name has 2 or more spaces, as explained in comment 1.

Actual result varies depending on how many spaces are in the mailing list name that user composes to, and if you combine with valid recipients or not (which is another bug).

[1]
List name:   My list-1-space
in To-field: My list-1-space <"My list-1-space">
Sending:     My list-1-space <"My list-1-space"> (correctly expanded)

[2]
List name:   My  list-2-space
in To-field: My  list-2-space <"My  list-2-space">
Sending:     My list-2-space <"My  list-2-space"> (when sending, double space in display name trimmed to single space, hence fails to expand the mailing list)

[3] (same as [2])
List name:   My   list-3-space
in To-field: My   list-3-space <"My list-3-space">
Sending:     My list-3-space <"My   list-3-space"> (when sending, triple space in display name trimmed to single space, hence fails to expand the mailing list)

Error messages:

...when composing to single mailing list without other recipients:
Composing to [1]: No error message, works fine
Composing to [2]: My list-2-space <"My  list-2-space"> is not a valid e-mail address because it is not of the form user@host. You must correct it before sending the e-mail.
Composing to [3]: My list-3-space <"My   list-3-space"> is not a valid e-mail address because it is not of the form user@host. You must correct it before sending the e-mail.

...when composing to mailing list with and at least one other valid email address or mailing list:
Composing to [1], [2] and [3]: No error message before sending (that's a bug! Combining with valid addresses shouldn't mute error messages, or should it?); message is silently sent with invalid email addresses: My list-2-space <"My  list-2-space">, My list-3-space <"My   list-3-space">, delivery fails which should return error messages from server.

Expected:
a) this bug: Mailing lists with 2 or more spaces in mailing list name should just expand correctly.
b) other bug: Trying to send to invalid email addresses (which could not be resolved as a mailing list), should always yield an error messsage when sending, even when combined with valid addresses (I think).
Summary: Address book misinterprets if more than one space in alias name. → Cannot compose to mailing list if list name (alias) contains 2 or more spaces
Summary: Cannot compose to mailing list if list name (alias) contains 2 or more spaces → Cannot compose to mailing list if list name (alias) contains 2 or more spaces (because TB trims whitespace in display name, then fails to expand the mailing list)
Summary: Cannot compose to mailing list if list name (alias) contains 2 or more spaces (because TB trims whitespace in display name, then fails to expand the mailing list) → Cannot compose to mailing list if list name (alias) contains 2 or more spaces (because TB trims whitespace in display name when sending, then fails to expand the mailing list)
See Also: → 683685
This should be re-evaluated and eventually fixed.
Does sending really look at the display name to resolve mailing lists!?

And I'm more worried about the second part of the bug described by me, sending to invalid mail address combined with valid mail address does not even yield an error message on our side. Again, this must be re-evaluated if it still applies.
Whiteboard: [good first bug]
Hi, I want to work on this, this would be my first contribution so any help would be great.
Wayne, can you see to it that Keshav gets the necessary assistance for tackling this bug? Tia

(In reply to keshavmanghat from comment #6)
> Hi, I want to work on this, this would be my first contribution so any help
> would be great.

Most welcome Keshav. Everyone is a bit busy with the pending TB release, so pls keep calling until you get helped ;-)
You'll probably need to start here:
https://developer.mozilla.org/en-US/docs/Mozilla/Developer_guide/Build_Instructions/Simple_Thunderbird_build
For some surface bugs you can get away without building TB, but this might not be one of those.

You'll also want to go back to comment 0 and re-test this bug to see exactly what happens.
When you're not yet building TB yourself, latest builds are here:
https://ftp.mozilla.org/pub/thunderbird/nightly/latest-comm-central/

Then you need to find out how the offending code works internally.
The entire codebase is mirrored here:
https://dxr.mozilla.org/comm-central/
Flags: needinfo?(vseerror)
Oh, also wanted to mention:
TB > Tools > Developer Tools > Developer Toolbox (Ctrl+Shift+I)
In the codebase, you can search for strings from UI, then find the corresponding XUL file, then find the attached code and where it lives. Something like that. Dev Tools help a lot with analysing the code.

One file which would be relevant for this bug:
https://dxr.mozilla.org/comm-central/search?q=file%3Amessengercompose.xul&=comm-central
I am currently working on two other bugs, I will pick this up as soon as I am done. I am still not sure where to start with this.
Flags: needinfo?(vseerror)
(In reply to keshavmanghat from comment #9)
> I am still not sure where to start with this.

best to ask in #maildev on irc or the dev-apps mailing list cited at https://www.thunderbird.net/en-US/get-involved/
Keywords: good-first-bug
Whiteboard: [good first bug]
Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.