Gergely Havlicsek
Gergely Havlicsek

Reputation: 1591

Zend_Mail will not send bcc to sender address

I have a problem, when I want to send mail to a customer and also to the admins.

The problem is, that the customer receives the mail, but the bcc will not if the from = bcc. Is there any setting I have missed? Could this be a server issue, or a Zend related one?

Example code I use:

$mail = new Zend_Mail();
$mail->setFrom( '[email protected]', 'Admin' )
->addTo( '[email protected]', 'Customer' )
->setBodyText( 'Example' )
->addBcc('[email protected]');

$mail->send();

The headers are (from $mail->getHeaders()):

array(3) {
  ["From"]=>
  array(2) {
    [0]=>
    string(26) "Admin <[email protected]>"
    ["append"]=>
    bool(true)
  }
  ["To"]=>
  array(2) {
    [0]=>
    string(25) "Customer <[email protected]>"
    ["append"]=>
    bool(true)
  }
  ["Bcc"]=>
  array(2) {
    [0]=>
    string(18) "[email protected]"
    ["append"]=>
    bool(true)
  }
}

Upvotes: 3

Views: 4041

Answers (4)

pe4k
pe4k

Reputation: 14

if you use only Bcc recipients without TO read this

http://framework.zend.com/issues/browse/ZF-3509

Upvotes: 0

Pankrates
Pankrates

Reputation: 3094

I stumbled on this post while working on using Zend_Mail to send a bcc to the sender address and found that for me the following does in fact work:

$fromName = 'admin';
$fromMail = '[email protected]';

$mail = new Zend_Mail();
$mail->setFrom($fromEmail, $fromName);
$mail->addBcc($fromMail);

Even though the bug report http://framework.zend.com/issues/browse/ZF-8723 as linked in RakeshS's post is still marked as unresolved. My Zend version is:

const VERSION = '1.11.12';

It would be interesting to learn whether the problem would also be solved for the original posters for the updated Zend framework, if they may happen to read this

Upvotes: 1

Rakesh Sankar
Rakesh Sankar

Reputation: 9415

There is a bug added to ZF which almost similar to this issue: http://framework.zend.com/issues/browse/ZF-8723

BTW, you could also get BCC to work with the help of Zend Mail Add Header method. Please try the following work-around:

$mail->addHeader('Bcc', '[email protected]');

Upvotes: 1

dinopmi
dinopmi

Reputation: 2673

I'm getting the same behavior as you. The sender is not getting the message if the address is added as Bcc. So, it's likely to be a Zend Mail related issue (I don't think we have the same server configuration).

Upvotes: 1

Related Questions