Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/email/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php codeigniter中的电子邮件概念_Php_Email - Fatal编程技术网

Php codeigniter中的电子邮件概念

Php codeigniter中的电子邮件概念,php,email,Php,Email,我是初学者,需要向所有填写注册表的人发送电子邮件验证链接。但我得到的错误如下: 无法使用PHPmail()发送电子邮件。您的服务器可能未配置为使用此方法发送邮件 Date: Thu, 17 May 2018 11:29:31 +0530 From: "Mydomain" <kumarinfo89@gmail.com> Return-Path: <kumarinfo89@gmail.com> Reply-To: <kumarinfo89@gmail.com> U

我是初学者,需要向所有填写注册表的人发送
电子邮件验证链接
。但我得到的错误如下: 无法使用PHP
mail()
发送电子邮件。您的服务器可能未配置为使用此方法发送邮件

Date: Thu, 17 May 2018 11:29:31 +0530
From: "Mydomain" <kumarinfo89@gmail.com>
Return-Path: <kumarinfo89@gmail.com>
Reply-To: <kumarinfo89@gmail.com>
User-Agent: CodeIgniter
X-Sender: kumarinfo89@gmail.com
X-Mailer: CodeIgniter
X-Priority: 5 (Lowest)
Message-ID: <5afd1a436d57c@gmail.com>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
日期:2018年5月17日星期四11:29:31+0530
发件人:“Mydomain”
返回路径:
答复:
用户代理:CodeIgniter
X-Sender:kumarinfo89@gmail.com
X-Mailer:CodeIgniter
X优先级:5(最低)
消息ID:
Mime版本:1.0
内容类型:文本/纯文本;字符集=UTF-8
内容传输编码:8比特
在上面我得到了相同的电子邮件发件人和答复你可以看到上面。我试过将
“\n”改为“\r\n”
,也试过将587改为465,以及在dds中的php.ini上。有什么帮助吗?我挣扎了一个多星期

configuration

    First of all paste the downloaded condeigniter directory inside server directory(e.g. for XAMPP xampp->htdocs folder)

    config codeigniter database connection in 

codeiniter->application->config->database.php
/*本地服务器*/

$db['default'] = array(
    'dsn'   => '',
    'hostname' => 'localhost',
    'username' => 'root',
    'password' => '',
    'database' => 'company',
    'dbdriver' => 'mysqli',
    'dbprefix' => '',
    'pconnect' => FALSE,
    'db_debug' => (ENVIRONMENT !== 'production'),
    'cache_on' => FALSE,
    'cachedir' => '',
    'char_set' => 'utf8',
    'dbcollat' => 'utf8_general_ci',
    'swap_pre' => '',
    'encrypt' => FALSE,
    'compress' => FALSE,
    'stricton' => FALSE,
    'failover' => array(),
    'save_queries' => TRUE
);
在公司数据库中创建Employee表

CREATE TABLE IF NOT EXISTS `employee` (
  `emp_id` int(11) NOT NULL AUTO_INCREMENT,
  `emp_name` varchar(200) NOT NULL,
  `address` varchar(250) NOT NULL,
  `email` varchar(200) NOT NULL,
  `username` varchar(100) NOT NULL,
  `password` varchar(100) NOT NULL,
  `status` tinyint(1) NOT NULL DEFAULT '0',
  PRIMARY KEY (`emp_id`)
) ENGINE=InnoDB  DEFAULT CHARSET=latin1 AUTO_INCREMENT=5 ;
在创建发送电子邮件函数之前,打开php>php.ini文件并找到“extension=php_openssl.dll”,然后删除行开头的分号。完成后,重新启动服务器

配置电子邮件设置

//config email settings
        $config['protocol'] = 'smtp';
        $config['smtp_host'] = 'ssl://smtp.gmail.com';
        $config['smtp_port'] = '465';
        $config['smtp_user'] = $from;
        $config['smtp_pass'] = '******';  //sender's password
        $config['mailtype'] = 'html';
        $config['charset'] = 'iso-8859-1';
        $config['wordwrap'] = 'TRUE';
        $config['newline'] = "\r\n"; 

        $this->load->library('email', $config);
    $this->email->initialize($config);


//send email
        $this->email->from($from);
        $this->email->to($receiver);
        $this->email->subject($subject);
        $this->email->message($message);

        $this->email->send()

我已经做了,但没有用。它显示为无法使用PHP mail()发送电子邮件。您的服务器可能未配置为使用此方法发送邮件。发件人电子邮件和收件人电子邮件对我来说都是相同的