user672546
user672546

Reputation: 101

CC and Bcc mailing via gmail smtp server, only To addresses goes through

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

Answers (2)

Rakesh Sankar
Rakesh Sankar

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

Friek
Friek

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

Related Questions