Skip Menu |

Preferred bug tracker

Please visit the preferred bug tracker to report your issue.

This queue is for tickets about the Email-Sender CPAN distribution.

Report information
The Basics
Id: 73055
Status: resolved
Priority: 0/
Queue: Email-Sender

People
Owner: Nobody in particular
Requestors: sfo [...] cargocult.ca
Cc:
AdminCc:

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



CC: sfo [...] cargocult.ca
Subject: Email::Sender::Simple and bcc header for VERSION = '0.110001'
Date: Tue, 6 Dec 2011 13:35:50 -0500 (EST)
To: bug-Email-Sender [...] rt.cpan.org
From: "Stephen Oberski" <sfo [...] cargocult.ca>
Email::Sender::Simple::VERSION = '0.110001' ==================================================================================== use Email::Sender::Simple qw(sendmail); use Email::Simple; use Email::Simple::Creator; use Email::MIME::Creator; ... my $email = Email::MIME->create( header_str => [ Bcc => join(',', @{$recipient_list_r}), # hide the recipient list From => $from, Subject => $subject, ], parts => [ @parts ], ); sendmail($email); ==================================================================================== This code snippet results in a "no recipients" message/exception from Email/Sender/Simple.pm. I made this local change to Email/Sender/Simple.pm: [root@ccc Sender]# pwd /usr/lib/perl5/site_perl/5.8.8/Email/Sender [root@ccc Sender]# uname -a Linux ccc.cargocult.ca 2.6.18-238.9.1.el5 #1 SMP Tue Apr 12 18:10:13 EDT 2011 x86_64 x86_64 x86_64 GNU/Linux [root@ccc Sender]# diff Simple.pm* 141c141 < qw(to cc bcc); --- Show quoted text
> qw(to cc);
That is I added bcc to the list to_addrs and that makes it work for me. I can now send Emails with only a Bcc thus hiding the recipient list. Thanks, -- Stephen Oberski sfo@cargocult.ca
CC: sfo [...] cargocult.ca
Subject: Re: [rt.cpan.org #73055] Email::Sender::Simple and bcc header for VERSION = '0.110001'
Date: Tue, 6 Dec 2011 15:07:46 -0500 (EST)
To: bug-Email-Sender [...] rt.cpan.org
From: "Stephen Oberski" <sfo [...] cargocult.ca>
Hi Ricardo, I have to disagree with the analysis of the bcc problem in the wiki. The addresses in the Bcc header appear in the transport envelope, that is they appear in the SMTP RCPT_TO list along with any addresses in the To and Cc headers but unlike the To and Cc headers the Bcc addresses do not appear in the Email header. There are no issues with sending such a message atomically and hiding the Bcc addresses from recipients. At the SMTP transport level we see: ... MAIL_FROM: from RCPT_TO: To #1 RCPT_TO: To #2 ... RCPT_TO: Cc #1 RCPT_TO: Cc #2 ... RCPT_TO: Bcc #1 RCPT_TO: Bcc #2 ... while in the Email header we will see: From: from To: to#1, to#2... Cc: cc#1, cc#2... But no Bcc header will appear in the Email header. Thus the intent of the Bcc header is maintained. There seems to be some confusion between the Email envelope (i.e. the sendmail/SMTP transport layer) and the Email header. The 2 are distinct and information in the envelope used to deliver Email does not have to appear in the Email header. As Email::Sender::Simple is implemented now it is not possible to hide the recipients even if one were to follow the (erroneous) suggestion in the wiki to send "one to to_rcpt and cc_rcpt, with no Bcc header present; and another to the_boss only, with the Bcc header." as Email::Sender::Simple does not pass Bcc addresses to the transport layer and in fact generates the "no recipients" exception if only a Bcc header but no To or Cc header is specified. So the suggestion in the wiki is wrong and it is not possible to send to undisclosed recipients using Email::Sender::Simple whether or not To and/or Cc headers are present. The fix I submitted does send the Email atomically to all To, Cc and Bcc recipients and it does hide the Bcc recipients from all recipients. Here is a Email header from a message sent to multiple Bcc recipients and no To or Cc recipients using the modified Email::Sender::Simple that I sent the patch for: Return-Path: <cargocult_moc_support@cargocult.ca> Received: from ccc.cargocult.ca ([unix socket]) by ccc.cargocult.ca (Cyrus v2.3.7-Invoca-RPM-2.3.7-12.el5_7.2) with LMTPA; Tue, 06 Dec 2011 10:14:57 -0500 X-Sieve: CMU Sieve 2.3 Received: from cargocult.cargocult.ca (d24-150-190-43.home.cgocable.net [24.150.190.43]) by ccc.cargocult.ca (8.13.8/8.13.8) with ESMTP id pB6FEucr010588; Tue, 6 Dec 2011 10:14:56 -0500 Received: from cargocult.cargocult.ca (cargocult.cargocult.ca [127.0.0.1]) by cargocult.cargocult.ca (8.13.8/8.13.8) with ESMTP id pB6FEt61002398; Tue, 6 Dec 2011 10:14:55 -0500 Received: (from sfo@localhost) by cargocult.cargocult.ca (8.13.8/8.13.8/Submit) id pB6FEtoB002395; Tue, 6 Dec 2011 10:14:55 -0500 Message-Id: <201112061514.pB6FEtoB002395@cargocult.cargocult.ca> X-Authentication-Warning: cargocult.cargocult.ca: sfo set sender to cargocult_moc_support@cargocult.ca using -f Bcc: From: cargocult_moc_support@cargocult.ca Subject: MOC - 2011/12/06 Date: Tue, 6 Dec 2011 10:14:55 -0500 MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="1323184495.fD5E4C0.2388"; charset="us-ascii" As you can see the Bcc: header is empty. It probably shouldn't be there at all but given that I changed one line of code that's good enough for me. There is probably a better way of doing this but my preference is that I report the problems and you fix them. By the way, this Email has a To, Cc and Bcc recipients and it was forwarded to my transport layer as a single/atomic message and the Bcc information is not disclosed to any other recipients. Thanks, -- Stephen Oberski sfo@cargocult.ca Show quoted text
Show quoted text
> but unlike the To and Cc headers the Bcc addresses do not > appear in the Email header.
What transport is being used under the hood? Sendmail? If so, it is removing the header for you. Re-send using the SMTP transport, for example, and you will see the header is left in place.
CC: sfo [...] cargocult.ca
Subject: Re: [rt.cpan.org #73055] Email::Sender::Simple and bcc header for VERSION = '0.110001'
Date: Tue, 6 Dec 2011 15:34:14 -0500 (EST)
To: bug-Email-Sender [...] rt.cpan.org
From: "Stephen Oberski" <sfo [...] cargocult.ca>
Hi Ricardo, I'll give that a try and report back. I appreciate the fact that you developed and maintain the Email::Sender (along with a large number of others) package so I hope I didn't come across to strongly in my previous message. I'm just looking to send my Emails to an undisclosed recipient list and my current problems with Email::Sender are more than likely due to my ignorance. Thanks, -- Stephen Oberski sfo@cargocult.ca Show quoted text
> <URL: https://rt.cpan.org/Ticket/Display.html?id=73055 > >
>> but unlike the To and Cc headers the Bcc addresses do not >> appear in the Email header.
> > What transport is being used under the hood? Sendmail? If so, it is > removing the header for you. > > Re-send using the SMTP transport, for example, and you will see the > header is left in place. >
CC: bug-email-sender [...] rt.cpan.org, sfo [...] cargocult.ca
Subject: Re: [rt.cpan.org #73055] Email::Sender::Simple and bcc header for VERSION = '0.110001'
Date: Tue, 6 Dec 2011 18:25:31 -0500 (EST)
To: sfo [...] cargocult.ca
From: "Stephen Oberski" <sfo [...] cargocult.ca>
Hi Ricardo, Here is what I get when I use Email::Sender::Transport::SMTP: ========================================================================================== my $email = Email::MIME->create( header_str => [ Bcc => join(',', @{$recipient_list_r}), # hide the recipient list From => $from, Subject => $subject, ], parts => [ @parts ], ); my $transport = Email::Sender::Transport::SMTP->new(); sendmail($email, { transport => $transport }); ========================================================================================== Here is a received Email header: ========================================================================================== Return-Path: <cargocult_moc_support@cargocult.ca> Received: from ccc.cargocult.ca ([unix socket]) by ccc.cargocult.ca (Cyrus v2.3.7-Invoca-RPM-2.3.7-12.el5_7.2) with LMTPA; Tue, 06 Dec 2011 18:11:40 -0500 X-Sieve: CMU Sieve 2.3 Received: from cargocult.cargocult.ca (d24-150-190-43.home.cgocable.net [24.150.190.43]) by ccc.cargocult.ca (8.13.8/8.13.8) with ESMTP id pB6NBd4b013782; Tue, 6 Dec 2011 18:11:39 -0500 Received: from localhost.localdomain (cargocult.cargocult.ca [127.0.0.1]) by cargocult.cargocult.ca (8.13.8/8.13.8) with ESMTP id pB6NBdB2005769; Tue, 6 Dec 2011 18:11:39 -0500 Message-Id: <201112062311.pB6NBdB2005769@cargocult.cargocult.ca> Bcc: From: cargocult_moc_support@cargocult.ca Subject: MOC - 2011/12/06 - update #1 Date: Tue, 6 Dec 2011 18:11:39 -0500 MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="1323213099.C02ffBb4.5723"; charset="us-ascii" ========================================================================================== And here are the sendmail log entries for the outbound delivery, i.e. this was the SMTP server that Email::Sender::Transport::SMTP connected to: Dec 6 18:11:39 cargocult sendmail[5769]: pB6NBdB2005769: from=<cargocult_moc_support@cargocult.ca>, size=85616, class=0, nrcpts=2, msgid=<201112062311.pB6NBdB2005769@cargocult.cargocult.ca>, proto=ESMTP, daemon=MTA, relay=cargocult.cargocult.ca [127.0.0.1] Dec 6 18:11:40 cargocult sendmail[5771]: pB6NBdB2005769: to=<cargocultcorp@gmail.com>,<sfo@cargocult.ca>, delay=00:00:01, xdelay=00:00:01, mailer=relay, pri=235616, relay=ccc.cargocult.ca. [199.85.16.201], dsn=2.0.0, stat=Sent (pB6NBd4b013782 Message accepted for delivery) You can see that the Bcc header addresses (<cargocultcorp@gmail.com>,<sfo@cargocult.ca>) were passed to the transport/envelope layer but did not appear in the Bcc: header above. But there is still an empty Bcc: header in the Email. Thoughts ? -- Stephen Oberski sfo@cargocult.ca Show quoted text
> Hi Ricardo, > > I'll give that a try and report back. > > I appreciate the fact that you developed and maintain the Email::Sender (along with a large number > of others) package so I hope I didn't come across to strongly in my previous message. > > I'm just looking to send my Emails to an undisclosed recipient list and my current problems with > Email::Sender are more than likely due to my ignorance. > > Thanks, > > -- > Stephen Oberski sfo@cargocult.ca >
>> <URL: https://rt.cpan.org/Ticket/Display.html?id=73055 > >>
>>> but unlike the To and Cc headers the Bcc addresses do not >>> appear in the Email header.
>> >> What transport is being used under the hood? Sendmail? If so, it is >> removing the header for you. >> >> Re-send using the SMTP transport, for example, and you will see the >> header is left in place. >>
> > >
What you are seeing is an implementation or configuration detail of an SMTP server along the way. Instead, look at the actual SMTP conversation. Here's an example one: <<< 220 walrus.local ESMTP Postfix Show quoted text
>>> EHLO localhost.localdomain
<<< 250-walrus.local <<< 250-PIPELINING <<< 250-SIZE 10485760 <<< 250-VRFY <<< 250-ETRN <<< 250-ENHANCEDSTATUSCODES <<< 250-8BITMIME <<< 250-DSN <<< 250-BINARYMIME <<< 250 CHUNKING Show quoted text
>>> MAIL FROM:<rjbs@cpan.org>
<<< 250 2.1.0 Ok Show quoted text
>>> RCPT TO:<rjbs@cpan.org>
<<< 250 2.1.5 Ok Show quoted text
>>> DATA
<<< 354 End data with <CR><LF>.<CR><LF> Show quoted text
>>> To: rjbs@cpan.org >>> Bcc: rjbs@cpan.org >>> From: rjbs@cpan.org >>> Subject: Test Bcc >>> Date: Wed, 7 Dec 2011 09:09:23 -0500 >>> MIME-Version: 1.0 >>> >>> Test. >>> .
<<< 250 2.0.0 Ok: queued as 188012004939 Show quoted text
>>> QUIT
<<< 221 2.0.0 Bye Note that the Bcc header *is* sent. The fact that some SMTP servers (or MDAs) will then strip it is unreliable, and not something Email::Sender::Simple should take as given – especially because sendmail and SMTP are not the only transports it might use.
CC: sfo [...] cargocult.ca
Subject: Re: [rt.cpan.org #73055] Email::Sender::Simple and bcc header for VERSION = '0.110001'
Date: Wed, 7 Dec 2011 10:17:59 -0500 (EST)
To: bug-Email-Sender [...] rt.cpan.org
From: "Stephen Oberski" <sfo [...] cargocult.ca>
Hi Ricardo, So I started my Email asking if there was a way to pass information directly to the transport layer and of course there it was in the Email::Sender::Manual::QuickStart manual: my $email = Email::MIME->create( header_str => [ From => $from, Subject => $subject, ], parts => [ @parts ], ); # recipient list is passed to the transport but does not appear in the Email header sendmail($email, { to => [ @{$recipient_list_r} ] }); I've blown away my nasty hack to Simple.pm and am now doing it the correct way. Thanks for your patience. -- Stephen Oberski sfo@cargocult.ca Show quoted text
> <URL: https://rt.cpan.org/Ticket/Display.html?id=73055 > > > What you are seeing is an implementation or configuration detail of an > SMTP server along the way. Instead, look at the actual SMTP > conversation. Here's an example one: > > <<< 220 walrus.local ESMTP Postfix
> >>> EHLO localhost.localdomain
> <<< 250-walrus.local > <<< 250-PIPELINING > <<< 250-SIZE 10485760 > <<< 250-VRFY > <<< 250-ETRN > <<< 250-ENHANCEDSTATUSCODES > <<< 250-8BITMIME > <<< 250-DSN > <<< 250-BINARYMIME > <<< 250 CHUNKING
> >>> MAIL FROM:<rjbs@cpan.org>
> <<< 250 2.1.0 Ok
> >>> RCPT TO:<rjbs@cpan.org>
> <<< 250 2.1.5 Ok
> >>> DATA
> <<< 354 End data with <CR><LF>.<CR><LF>
> >>> To: rjbs@cpan.org > >>> Bcc: rjbs@cpan.org > >>> From: rjbs@cpan.org > >>> Subject: Test Bcc > >>> Date: Wed, 7 Dec 2011 09:09:23 -0500 > >>> MIME-Version: 1.0 > >>> > >>> Test. > >>> .
> <<< 250 2.0.0 Ok: queued as 188012004939
> >>> QUIT
> <<< 221 2.0.0 Bye > > Note that the Bcc header *is* sent. The fact that some SMTP servers (or > MDAs) will then strip it is unreliable, and not something > Email::Sender::Simple should take as given – especially because sendmail > and SMTP are not the only transports it might use. >
I'm glad you see it as patience, because I've felt shamefully impatient! It's... been a busy week. :-) Have fun hacking… -- rjbs