CC: | "Rechtin, Ray" <Ray.Rechtin [...] charter.com>, "Warren, Brian" <brian.warren [...] charter.com> |
Subject: | spaces prevent delivery of email; no warning raised |
Date: | Tue, 13 Aug 2013 13:07:43 -0500 |
To: | "bug-Mail-Sender [...] rt.cpan.org" <bug-Mail-Sender [...] rt.cpan.org> |
From: | "Jacobson, Jon K" <Jon.Jacobson [...] charter.com> |
Dear Mail::Sender maintainer:
First off, thanks for a great Module. We use it extensively. However, I did find a surprising "gotcha" recently: if the 'to' parameter is given an array ref, any element that contains a space will be ignored.
Assuming that 'works@email.com','also_works@email.com', and 'skipped@email.com' are all valid emails:
(1) ..., 'to' => 'works@email.com, also_works@email.com', ...
(2) ..., 'to' => ['works@email.com',' skipped@email.com'], ...
(3) ..., 'to' => ['works@email.com'], ...
(4) ..., 'to' => [' skipped@email.com'], ...
In these examples, 'works' and 'also_works' would receive their emails, but 'skipped' would not receive any emails due to the leading space.
I encountered this issue when I took a working "to string" that contained whitespace and converted it into an array of elements by splitting on the comma. I thought to use the resulting arrayref in the to-field of Mail::Sender. Some recipients got their emails, but those that had a space did not.
It looks like a change might be made to _prepare_addressess (line 1150) to remove whitespace from elements of the array ref or throw an error.
Thanks for your time!