In Already build project management system software. I like to Add some more feature. In my Application there is a functionality of messages means one user can sent message to his client or another user that message receiver can see his dashboard and he also receive that message to his mail inbox
so that i create code that send that message to both my email address and that users email address
but the problem is that when receiver reply to that mail message only went to only one email address that i put in reply-to
So how can i put more than one email address in php mail or any other way to send reply mail to multiple email address
here is my code for send mails
function send_notification($sender, $receiver, $super, $email, $subject, $text ) {
$instance =& get_instance();
$instance->load->helper('file');
$instance->load->library('parser');
$data["core_settings"] = Setting::first(array('conditions' => array('admin_id = ?', $super)));
$instance->email->from($data["core_settings"]->email, $data["core_settings"]->company);
$instance->email->reply_to("def@example.com", "mnp", "abc@example.com", "ABC DEF");
$instance->email->to($email);
$instance->email->subject($subject);
//Set parse values
$parse_data = array(
'company' => $data["core_settings"]->company,
'link' => base_url(),
'logo' => '<img src="'.base_url().''.$data["core_settings"]->logo.'" alt="'.$data["core_settings"]->company.'"/>',
'invoice_logo' => '<img src="'.base_url().''.$data["core_settings"]->invoice_logo.'" alt="'.$data["core_settings"]->company.'"/>',
'message' => $text
);
$email_invoice = read_file('./application/views/'.$data["core_settings"]->template.'/templates/email_notification.html');
$message = $instance->parser->parse_string($email_invoice, $parse_data);
$instance->email->message($message);
$instance->email->send();
}
You can try some thing like this
$list = array('one@example.com', 'two@example.com', 'three@example.com');
$instance->email->reply_to($list, 'Your Name');
OR
$instance->email->reply_to('one@example.com, two@example.com, three@example.com', 'Your Name');
I hope this helps you!
Make a for loop that goes trough all your email addresses. You can put your email addresses in a database or array what ever you prefer.
Using an array:
$emailAdresses = array("example@mail.com", "example2@mail.com");
foreach ($emailAdresses as $i) {
mail($emailAdresses[$i],"","");
}