为什么我的电子邮件不是从CodeIgniter发送的?

时间:2016-02-24 02:33:57

标签: php codeigniter email mandrill

我的codeigniter脚本不会发送电子邮件。我已经使用本机PHP电子邮件脚本在xampp上测试了sendmail,它可以工作。这绝对是CI或我的配置的问题。 send()函数始终返回false,print_debugger()函数始终为空。我做错了吗?

<?php

            $config = array(
                'mailtype' => 'html',
                'protocol' => 'smtp',
                'smtp_host' => 'smtp.gmail.com',
                'smtp_user' => 'myaccount@gmail.com',
                'smtp_pass' => '#############',
                'smtp_port' => '465'
            );

            $this->load->library('email', $config);
            $this->email->from($this->stg['site_name']);
            $this->email->to($this->input->post('email_address'));
            $this->email->subject('Your Account Email Has Been Changed');

            $data = array(
                'activation_code' => $this->member->activation_code
            );

            $message = $this->load->view('emailTemplates/change_email', $data, true);

            $this->email->message($message);

            if(!$this->email->send()){

                $this->template->overallHeader('Email Failed');

                $data = array(
                    'title' => 'Email Sending Failed',
                    'message' => 'The system failed to dispatch the email message to your new email address.  Because of this, the email address on your account has NOT been changed. '.$this->email->print_debugger()
                );

                $this->load->view('errorBody', $data);              

            } else {

                //do stuff

            }

我也尝试过静态字符串而不是表单输入变量作为to和from等。

0 个答案:

没有答案