Skip Menu |

This queue is for tickets about the MIME-Lite CPAN distribution.

Report information
The Basics
Id: 65606
Status: open
Priority: 0/
Queue: MIME-Lite

People
Owner: Nobody in particular
Requestors: aveckey [...] hotmail.com
Cc: ether [...] cpan.org
AdminCc:

Bug Information
Severity: Important
Broken in: (no value)
Fixed in: (no value)



Subject: MIME::Lite can not send to multiple people via SMTP if a list reference is used to specify the 'To'
The send_by_smtp function only takes the first entry of the list reference passed to the constructor's 'To' field. However, if a single string that contains the addresses is used and not a list reference, the function will send to all parties. This looks to be caused by the 'scalar' function when setting the @hdr_to list my @hdr_to = extract_only_addrs( scalar $self->get('To') ); The POD of MIME::Lite explicitly states that the 'To' field can be a string or a list reference of strings. So it is implied that all the addresses listed in the reference will be processed to get the message that is being sent.
On Wed Feb 09 17:15:09 2011, aveckey wrote: Show quoted text
> The send_by_smtp function only takes the first entry of the list > reference passed to the constructor's 'To' field. However, if a single > string that contains the addresses is used and not a list reference, the > function will send to all parties.
I've run into this too. By calling $msg->print(\*STDOUT) immediately before sending, I can see that multiple To: headers are generated if a listref is used, which afaik is contrary to RFC 2822. my $msg = MIME::Lite->new( From => $addr1, To => [ $addr1, $addr2, ], Subject => 'TEST', Type => 'TEXT', Data => $data, ); $msg->send('smtp',$server); $msg->print(\*STDOUT); ...results in headers: MIME-Version: 1.0 Content-Disposition: inline Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Mailer: MIME::Lite 3.027 (F2.74; T1.32; A2.04; B3.13; Q3.13) Date: Thu, 26 Jan 2012 19:51:30 +0000 From: addr1 To: addr1 To: addr2 Subject: TEST But this: my $msg = MIME::Lite->new( From => $addr1, To => "$addr1, $addr2", Subject => 'TEST', Type => 'TEXT', Data => $data, ); $msg->send('smtp',$server); $msg->print(\*STDOUT); ...results in headers: MIME-Version: 1.0 Content-Disposition: inline Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Mailer: MIME::Lite 3.027 (F2.74; T1.32; A2.04; B3.13; Q3.13) Date: Thu, 26 Jan 2012 19:51:30 +0000 From: addr1 To: addr1, addr2 Subject: TEST
http://tools.ietf.org/html/rfc5322#section-3.6 says that the To: header should be included a maximum of 1 times, so this is definitely not correct behaviour.