无法使用PHP邮件()发送电子邮件。您的服务器可能未配置为使用此方法发送邮件。码信号3 [英] Unable to send email using PHP mail(). Your server might not be configured to send mail using this method. codeigniter 3

查看:411
本文介绍了无法使用PHP邮件()发送电子邮件。您的服务器可能未配置为使用此方法发送邮件。码信号3的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用codeigniter 3

i am using codeigniter 3

我在直播服务器中执行此电子邮件代码

i executed this email code in live server

错误

无法使用PHP邮件()发送电子邮件。您的服务器可能未配置为使用此方法发送邮件。

Unable to send email using PHP mail(). Your server might not be configured to send mail using this method.

            // send email
            $this->load->library('email');
            $this->email->from('your@example.com', 'Your Name');
            $this->email->to('chait11@gmail.com'); 
            $this->email->cc('another@another-example.com'); 
            $this->email->bcc('them@their-example.com'); 
            $this->email->subject('Email Test');
            $this->email->message('Testing the email class.');  
            $this->email->send();
            echo $this->email->print_debugger();

            $config['protocol'] = 'sendmail';
            //$config['protocol'] = 'mail';
            $config['mailpath'] = '/usr/sbin/sendmail';
            //$config['mailtype'] = 'text';
            $config['charset'] = 'iso-8859-1';
            $config['wordwrap'] = TRUE;

            $this->email->initialize($config);


推荐答案

                $config = array();
                $config['useragent']           = "CodeIgniter";
                $config['mailpath']            = "/usr/bin/sendmail"; // or "/usr/sbin/sendmail"
                $config['protocol']            = "smtp";
                $config['smtp_host']           = "localhost";
                $config['smtp_port']           = "25";
                $config['mailtype'] = 'html';
                $config['charset']  = 'utf-8';
                $config['newline']  = "\r\n";
                $config['wordwrap'] = TRUE;

                $this->load->library('email');

                $this->email->initialize($config);

                $this->email->from('xxx@gmail.com', 'admin');
                $this->email->to('xxx@gmail.com');
                $this->email->cc('xxx@gmail.com'); 
                $this->email->bcc($this->input->post('email')); 
                $this->email->subject('Registration Verification: Continuous Imapression');
                $msg = "Thanks for signing up!
            Your account has been created, 
            you can login with your credentials after you have activated your account by pressing the url below.
            Please click this link to activate your account:<a href=\"".base_url('user/verify')."/{$verification_code}\">Click Here</a>";

            $this->email->message($msg);   
            //$this->email->message($this->load->view('email/'.$type.'-html', $data, TRUE));

            $this->email->send();

这篇关于无法使用PHP邮件()发送电子邮件。您的服务器可能未配置为使用此方法发送邮件。码信号3的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆