I followed the documentation on the Swift Mailer website, but I can't seem to get the mailer to send to undisclosed recipients. I have also since tried sending the To: header to the same as the From address. However, the mail does not seem to be getting to the recipient list. Here is my code:
if($undisclosed)
{
$message->setTo($mailFrom);
}
$recipients = $this->constructRecipientList();
// Send
$mailer->send($message, $recipients, $mailFrom);
$mailer->disconnect();
$recipients is a valid recipient list, constructed as follows:
$recipients = new Swift_RecipientList();
if(is_array($this->mailTo))
{
foreach($this->mailTo AS $recipient)
{
$recipients->addTo($recipient);
}
}
else
{
$recipients->addTo($this->mailTo);
}
return $recipients;
I am currently sending the mails through Gmail. When I sent it to "undisclosed-recipients:;" I was not getting any delivery at all. Once I set the To: header to the same as the From address, the mail seems to be sent to the from address, but the recipient list is still ignored.
Is there something I'm doing wrong?
Thanks.
Steve