several BCC addresses
Moderators: Chris Corbyn, General Moderators
- Chris Corbyn
- Breakbeat Nuttzer
- Posts: 13098
- Joined: Wed Mar 24, 2004 7:57 am
- Location: Melbourne, Australia
Re: several BCC addresses
BCC addresses should not see each others' addresses. They should only see their own, so there should just be one Bcc: line in each email.
Re: several BCC addresses
It must be possible to send an email to several BCC addresses.
I suppose the mail header should look like this:
Bcc: aa@bb.cc, dd@ee.ff
But when I have this code
$recipients->addBcc('aa@bb.cc');
$recipients->addBcc('dd@ee.ff');
the header looks this way:
Bcc: aa@bb.cc,
dd@ee.ff
And obviously the SMTP-server doesn't understand the newline and the BCC is only sent to aa@bb.cc and not to dd@ee.ff.
This seems a bug to me.
Emilio
I suppose the mail header should look like this:
Bcc: aa@bb.cc, dd@ee.ff
But when I have this code
$recipients->addBcc('aa@bb.cc');
$recipients->addBcc('dd@ee.ff');
the header looks this way:
Bcc: aa@bb.cc,
dd@ee.ff
And obviously the SMTP-server doesn't understand the newline and the BCC is only sent to aa@bb.cc and not to dd@ee.ff.
This seems a bug to me.
Emilio
- Chris Corbyn
- Breakbeat Nuttzer
- Posts: 13098
- Joined: Wed Mar 24, 2004 7:57 am
- Location: Melbourne, Australia
Re: several BCC addresses
If both Bcc recipients are in the same Bcc header then the entire point of Bcc has been violated and RFC 2822 has not been conformed to.uyuni wrote:It must be possible to send an email to several BCC addresses.
I suppose the mail header should look like this:
Bcc: aa@bb.cc, dd@ee.ff
But when I have this code
$recipients->addBcc('aa@bb.cc');
$recipients->addBcc('dd@ee.ff');
the header looks this way:
Bcc: aa@bb.cc,
dd@ee.ff
And obviously the SMTP-server doesn't understand the newline and the BCC is only sent to aa@bb.cc and not to dd@ee.ff.
This seems a bug to me.
Emilio
What Swift mailer *should* be doing is sending *two* separate emails that have differing headers:
Bcc: address1@domain.com
AND in a separate email
Bcc: address2@domain.com
Are you saying that Swift Mailer is showing both addresses in the headers? Can you please post the full code you are using?
Re: several BCC addresses
This is my code:
There is one email sent and in the file MailSend.php in the funtion sendPerformed I log the headers before they are used in the mail-function:
This seems wrong and does not work correctly.
Emilio
Code: Select all
$recipients->addBcc('aa@bb.cc');
$recipients->addBcc('dd@ee.ff');Code: Select all
Return-Path: <info@xxx.com>
From: Name <info@xxx.com>
Bcc: aa@bb.cc,
dd@ee.ff
Reply-To: Name <info@xxx.com>
Date: Thu, 12 Feb 2009 07:43:08 +0100
X-LibVersion: 3.3.2
MIME-Version: 1.0
Content-Type: multipart/alternative;
boundary="_=_swift-231224993c4fcb495f6.37827623_=_"
Content-Transfer-Encoding: 7bit
Message-ID: <20090212064308.5904.1718430715.swift@xxx.com>Emilio
- Chris Corbyn
- Breakbeat Nuttzer
- Posts: 13098
- Joined: Wed Mar 24, 2004 7:57 am
- Location: Melbourne, Australia
Re: several BCC addresses
I need to see more code. When you say in beforeSendPerformed() you logged the headers, what code did this, and what Connection type were you using? 
Also, are you using send() or batchSend()?
Also, are you using send() or batchSend()?
Re: several BCC addresses
File MailSend.php:
I used
Emilio
Code: Select all
public function doMail($to, $subject, $message, $headers, $params)
{
$original_from = @ini_get("sendmail_from");
@ini_set("sendmail_from", $this->returnPath);
$headers = $headers->build();
[color=#FF0000]>>> here I did: var_dump($headers)[/color]
if (!ini_get("safe_mode")) $success = mail($to, $subject, $message, $headers, $params);
else $success = mail($to, $subject, $message, $headers);
if (!$success)
{
@ini_set("sendmail_from", $original_from);
throw new Swift_ConnectionException("Sending failed using mail() as PHP's default mail() function returned boolean FALSE.");
}
@ini_set("sendmail_from", $original_from);
}
Code: Select all
[color=#FF0000]$swift->send[/color]- Chris Corbyn
- Breakbeat Nuttzer
- Posts: 13098
- Joined: Wed Mar 24, 2004 7:57 am
- Location: Melbourne, Australia
Re: several BCC addresses
Ok, so you're correct that if you're using the NativeMail connection, Swift does build all Bcc addresses into one header. That's because mail() requires it. You're also correct that Swift is splitting the addresses onto multiple lines. What I'm not sure you're entirely correct about is the use of whitespace. Swift should be doing this:
Notice the space (or tab) on the second line? That makes it parts of the same header. If it's not doing this (and you're 100% that it's not) then this is a bug. If it's doing this, then that is the 100% expected behaviour (in version 3).
Code: Select all
Bcc: address1@domain.com,
address2@domain.comRe: several BCC addresses
Then your code and the header is correct.
Unfortunately the SMTPserver of my provider does not understand this and sends the mail only to the first BCC.
Emilio
Unfortunately the SMTPserver of my provider does not understand this and sends the mail only to the first BCC.
Emilio
- Chris Corbyn
- Breakbeat Nuttzer
- Posts: 13098
- Joined: Wed Mar 24, 2004 7:57 am
- Location: Melbourne, Australia
Re: several BCC addresses
That is definitely a bug with the server in which case, and not with Swift Mailer. Can you be 100% that the other address is not being rejected by the server? I mean, have you tried swapping the addresses around? It's unlikely to be because the second one is on a new line... it's more likely that the domain name of it is being rejected, or that the email is being blocked as spam for that particular recipient.uyuni wrote:Then your code and the header is correct.
Unfortunately the SMTPserver of my provider does not understand this and sends the mail only to the first BCC.
Emilio