SMTP主机地址与“到”电子邮件地址一起添加

时间:2016-09-16 05:42:48

标签: php codeigniter email

我正在使用CodeIgniter发送多封电子邮件。当我发送电子邮件时,我的smtp主机地址也添加到'到'电子邮件地址。请帮助。即使在使用print_debugger();

之后也没有输出

下面是代码

CONTROLLER

function massmail(){
            $config = Array(       
                'protocol' => 'sendmail',
                'smtp_host' => '..server.net',
                'smtp_port' => 25,
                'smtp_user' => 'email@test.com',
                'smtp_pass' => 'password',
                'smtp_timeout' => '10',
                'mailtype'  => 'html',
                'charset'   => 'iso-8859-1'
            );

            $this->load->library('email', $config);
            $this->email->set_newline("\r\n");

            $data['send_emails'] = $this->email_model->getmails();
            $body = $this->load->view('view/newmail',$data,TRUE);
            foreach ($data['send_emails'] as $name => $address){ 
                $this->email->clear();
                $this->email->to($address);
                $this->email->from('from@mailsender.com');
                $this->email->subject('Email subject '.$name);                
                $this->email->message($body);
                $this->email->send();
            }

            echo $this->email->print_debugger();

        }

MODEL

function getmails(){
            $query = $this->db->query("select email from table_name where email !=''");
            return $query->result_array();
        }

查看

newmail.php

<table>
    <tr>
        <td>this is a test</td>
    </tr>
</table>

导致电子邮件客户端

from:   from@mailsender.com
reply-to:   "from@mailsender.com" <from@mailsender.com>
to: 2@sg2plcpnl0205.XXX.XXXX.XXXXXX.net,
jose@sg2plcpnl0205.XXX.XXXX.XXXXXX.net,
3444@sg2plcpnl0205.XXX.XXXX.XXXXXX.net,
tomail@receiver.com,
0@sg2plcpnl0205.xxx.xxxx.xxxxxxx.net
date:   Tue, Sep 6, 2016 at 8:56 PM
subject:    this is a test
encryption: Standard (TLS)

0 个答案:

没有答案