简体   繁体   English

在回复PHP中添加多个电子邮件地址

[英]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 那么我如何才能在PHP邮件中放置多个电子邮件地址或将回复邮件发送到多个电子邮件地址的任何其他方式

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();

}

Make a for loop that goes trough all your email addresses. 进行遍历所有电子邮件地址的for循环。 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],"","");
}

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! 我希望这可以帮助你!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM