PEAR is discontinued

This is a static archive preserving historical releases and metadata. No new packages or updates will be published. For updates to existing packages, or to publish new packages, please use Composer and Packagist.

Home » Mail » Mail_Queue » Bug #5707

Bcc functionality lost with Mail::Queue?

Details

Submitted2005-10-17 16:43 UTC
Fromben at nlcweb dot com
Assignedquipo
StatusClosed
PackageMail_Queue
PHP Version4.4.0
OSLinux
Roadmaps(Not assigned)

Comments

[2005-10-17 16:43 UTC] ben at nlcweb dot com

Description:
------------
There seems to be an issue with how the Bcc header is handled in mail::queue. In mail::send(), you are allowed to specify an array for the recipients, however when storing recipients in a database for mail::queue, only a string can be stored. By placing the Bcc in the headers, they appear to not be translated correctly when emails are sent.

Test script:
---------------
(Based off of add_message.php = http://pear.php.net/manual/en/package.mail.mail-queue.mail-queue.tutorial.php)

$from = 'user@server.com';
$to = "user2@server.com";
$bccto = "BCCuser@server.com";
$message = 'This is a test message.';

$hdrs = array( 'From' => $from,
'To' => $to,
'Bcc' => $bccto,
'Subject' => "Test Message" );

$mime =& new Mail_mime();
$mime->setTXTBody($message);
$body = $mime->get();
$hdrs = $mime->headers($hdrs);

$mail_queue->put( $from, $to, $hdrs, $body );

Expected result:
----------------
Two separate emails, one to $to recipient, one to $bccto recipient.

Email Headers:
Return-path: <adminuser@server.com>
Envelope-to: user@server.com
Delivery-date: Mon, 17 Oct 2005 09:17:58 -0700
Received: from [IP] (port=34140 helo=localhost)
by someserver.net with esmtp (Exim 4.52)
id 1ERXgS-0007BH-Mo
for user@server.com; Mon, 17 Oct 2005 09:17:56 -0700
MIME-Version: 1.0
From: adminuser@server.com
Subject: Test Message
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 7bit

Actual result:
--------------
Only receiving one email to first intended recipient ($to) with Bcc still in the header.

Email Headers:
Return-path: <adminuser@server.com>
Envelope-to: user@server.com
Delivery-date: Mon, 17 Oct 2005 09:17:58 -0700
Received: from [IP] (port=34140 helo=localhost)
by someserver.net with esmtp (Exim 4.52)
id 1ERXgS-0007BH-Mo
for user@server.com; Mon, 17 Oct 2005 09:17:56 -0700
MIME-Version: 1.0
From: adminuser@server.com
Bcc: BCCuser@server.com
Subject: Test Message
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 7bit

[2005-10-17 16:48 UTC] ben at nlcweb dot com

I also want to point out that the same results are achieved by substituting the following code in place of Bcc in the $hdrs array:

$mime =& new Mail_mime();
$mime->setTXTBody($message);
$mime->addBcc($bccto);
$body = $mime->get();
$hdrs = $mime->headers($hdrs);

[2005-10-17 23:02 UTC] ben at nlcweb dot com

Well, I have discovered a different way to handle what I origianlly wanted to do (using delete after send and creating a separate email for each recipient). The database I am using this for has around 5000 members of which ~3000 want these specific emails that I am generating. With your patch, will I still be able to batch send, being that only one database entry would be created with ~3000 Bcc entries? The answer to that will determine whether or not I need the patch.

Everything is still be tested for this new system, so I don't have any desirable data in the databases. Thanks for clearing up the $hdrs part as well.

[2005-10-27 04:34 UTC] adrian at vervesoftware dot net

Hi,
I'd love to get a copy of your patch too, if you don't mind sending. Mail::Queue seemed like the perfect solution to my problem until I noticed this bug report :(
thanks

[2005-12-13 22:13 UTC] ben at nlcweb dot com

I haven't had a chance to try the latest CVS version and I am not certain that I will. I have all of the functionality that I need from it at the moment, so unless a secuirty bug creeps up or my host jumps to PHP5, I will keep it the way it is.

You can probably close this issue. If I upgrade and find an issue, I will locate this post and get the issue reopened.

Thanks!

[2006-01-31 20:06 UTC] rlwixson at thoughtprocess dot net

I have downloaded the most recent from cvs, but I cannot get the Bcc line to work. Could you please provide a working example using the Bcc, as well as the correct version numbers of the files to use?

[2006-03-08 19:27 UTC] dick at dickwilliamson dot com

I'm trying to send blind carbon copies, too, and found they are not sent. It wasn't clear from the comment by Ben if "$mime->addBcc($bccto);" works or has the same problem as $headers['Bcc'].

There was no example to send the queue in a different process than inserting. Obviously, I don't want the user to wait while a large queue is being sent. If someone has an example of sending the queue asynychronously, that would be fine, too.

I just need some way that works to send to a large list of addresses without exposing addresses to everyone on the list.