Jump to content

Mime mail multiple cc


haike00
 Share

Recommended Posts

I am having this problem using mime mail to send e-mail with multiple cc recipients. To be exact, if I have more than 2 e-mail address in the cc list, starting from 3rd recipient onward, none of them in the cc list is able to receive the e-mail. To put it in another word, only first 2 recipients in the cc list is able to receive the e-mail.. I have no idea what happened at all, hope somebody can give me some direction.

<?php   require_once 'mail.php';   require_once 'mime/mime.php';    $mailTo = array(	  'x@abc.com',   );    $mailCc = array(	  'a@abc.com',	  'b@abc.com',	  // receipient set after this will not be able to receive the e-mail	  'c@abc.com',   );    $headers['Subject'] = 'PHP mail test';   $headers['From'] = 'phpmailteam@abc.com';   $headers['Cc'] = implode(', ', $mailCc);   $message = 'Test send text e-mail';    $mime =& new Mail_Mime;   $result = $mime->setTXTBody($message);   $mbody = $mime->get();    $headers = $mime->headers($headers);    $mail =& Mail::factory('mail');   $result = $mail->send($mailTo, $headers, $mbody);?>

Edited by haike00
Link to comment
Share on other sites

The only problem I see with that code is the extra commas at the end of the arrays.
I try removing the last comma but the problem remains..Anyway, thanks for pointing that out. =) Have anybody success in using mime mail to send to more than 2 CC recipients before?
Link to comment
Share on other sites

There's not an issue with the code there, it may be an issue with the mail server you're sending through or the recipient server.
I am thinking this could be the problem as well but I have no rights to touch on the configuration of the MTA, my IT dept colleague insists its my code problem.Their reason is simple, we can have multiple cc recipients when we use ms outlook to send the e-mail, and I do not know how to reply this.Do you have any idea what could be the possible configuration on MTA that caused this problem? Or maybe, I can add some headers to the e-mail to make the MTA "thinks" that I am sending e-mail from ms outlook or something similar?
Link to comment
Share on other sites

I doubt the MTA is set up to only work for Outlook and would block things that aren't Outlook. One thing you can do is print out $headers after the call to $mime->headers, by that point I believe it is a string. You can show that to your IT guys to help pinpoint the problem.

Link to comment
Share on other sites

Okay, this is fun, I turned to use phpmailer and things work. I compare the header between the 2 e-mails generated from mime_mail and phpmailer, there is nothing much difference.I suppose the problem lies with the parameter being set, will study this issue further when I have some free time.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...