Reputation: 101
When sending mail using php to to
, cc
, bcc
addresses through Gmail SMTP port 465(tried 587 too), it goes only to the to address.
For some reason the headers are rejected at the cc
and bcc
addresses. But when the same headers are send via sendmail, it reaches the destinations properly. Wht could be the problem,
The header used is:
$headers = array (
'From' => $from,
'To' => $to,
//'Reply-To' => $from,
//'Return-Path' => $from,
'Cc' => $Cc,
'Bcc' => $Bcc,
'Subject' => $subject,
'Date'=>date('D, d M Y H:i:s O'),
'Message-ID' =>'<'.Misc::randCode(6).''.time().'-'.$this->getEmail().'>',
'X-Mailer' =>'osTicket v 1.6',
'Content-Type' => 'text/html; charset="UTF-8"'
);
Upvotes: 2
Views: 2463
Reputation: 9415
I will first look into the errors or response in the LOGS (/var/log/mail.log
) and mail for ROOT user (vi /var/mail/root
). Since, if you think the headers or your CC/BCC is getting rejected, then you should get a failure response
from the response and that will always go to the default account which is root
here.
Also,
Upvotes: 0
Reputation: 1541
Cc and Bcc are no headers which do anything on SMTP level. You should implement it yourself, by sending the mail to individual recipients (multiple RCPT TO commands on SMTP level) or stick to using your local sendmail instead, as your sendmail client does implement Bcc and Cc header handling.
Upvotes: 1