user3604115
user3604115

Reputation: 31

Add Multiple email Address in Reply-to PHP

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("[email protected]", "mnp", "[email protected]", "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();

}

Upvotes: 0

Views: 2613

Answers (2)

Deepak Goswami
Deepak Goswami

Reputation: 2030

You can try some thing like this

$list = array('[email protected]', '[email protected]', '[email protected]');
$instance->email->reply_to($list, 'Your Name');

OR

$instance->email->reply_to('[email protected], [email protected], [email protected]', 'Your Name');

I hope this helps you!

Upvotes: 0

JoeriSmits
JoeriSmits

Reputation: 254

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("[email protected]", "[email protected]");
foreach ($emailAdresses as $i) {
  mail($emailAdresses[$i],"","");
}

Upvotes: 1

Related Questions