Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/codeigniter/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

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/user-interface/2.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发送SMTP Gmail_Php_Codeigniter_Email_Smtp_Gmail - Fatal编程技术网

Php CodeIgniter发送SMTP Gmail

Php CodeIgniter发送SMTP Gmail,php,codeigniter,email,smtp,gmail,Php,Codeigniter,Email,Smtp,Gmail,嘿,伙计们,我正在尝试为我正在开发的这个论坛创建一个重置密码。。。。不管怎么说,我遵循了一系列指南,尝试了许多版本的内容,这是一个错误最少的版本。。。。我还是不知道怎么了,我需要你的帮助 class CI_Email { //in library email.php var $useragent = "CodeIgniter"; var $mailpath = "/usr/sbin/msmtp"; // Sendmail path var $protocol

嘿,伙计们,我正在尝试为我正在开发的这个论坛创建一个重置密码。。。。不管怎么说,我遵循了一系列指南,尝试了许多版本的内容,这是一个错误最少的版本。。。。我还是不知道怎么了,我需要你的帮助

class CI_Email {  //in library email.php

var $useragent      = "CodeIgniter";
var $mailpath       = "/usr/sbin/msmtp";    // Sendmail path
var $protocol       = "smtp";   // mail/sendmail/smtp
var $smtp_host      = "smtp.googlemail.com";        // SMTP Server.
var $smtp_user      = "mymail@gmail.com";       // SMTP Username
var $smtp_pass      = "mypass";     // SMTP Password
var $smtp_port      = "465";        // SMTP Port
var $smtp_timeout   = 5;        // SMTP Timeout in seconds
var $smtp_crypto    = "";       // SMTP Encryption. Can be null, tls or ssl.
var $mailtype       = "html";   // text/html  Defines email formatting
var $charset        = "utf-8";  // Default char set: iso-8859-1 or us-ascii
这就是结果: hello: The following SMTP error was encountered: Failed to send AUTH LOGIN command. Error: from: The following SMTP error was encountered: to: The following SMTP error was encountered: data: The following SMTP error was encountered:

The following SMTP error was encountered: Unable to send email using PHP SMTP. Your server might not be configured to send mail using this method. Content-Type: multipart/alternative; boundary="B_ALT_51cd96f2daf24"

This is a multi-part message in MIME format. Your email application may not support this format.

--B_ALT_51cd96f2daf24 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit

My text here...

--B_ALT_51cd96f2daf24 Content-Type: text/html; charset=utf-8 Content-Transfer-Encoding: quoted-printable 或:


smtp\u主机中使用SSL协议时,我收到了无数错误的无休止的屏幕。

我使用了一个测试Gmail帐户进行非生产CodeIgniter电子邮件测试,但是当我部署到生产服务器时,我使用
环境
常量来检测正确的邮件连接设置

对于Gmail,我发现这些配置设置(我放在
/application/config/email.php
中)工作正常:

    $config = Array(
      'protocol' => 'smtp',
      'smtp_host' => 'ssl://smtp.googlemail.com',
      'smtp_port' => 465,
      'smtp_user' => '<test-account-name>@gmail.com',
      'smtp_pass' => '<test-account-password>',
    );
$config=Array(
'协议'=>'smtp',
'smtp_主机'=>'ssl://smtp.googlemail.com',
“smtp_端口”=>465,
“smtp_用户”=>“@gmail.com”,
'smtp_pass'=>'',
);
您的电子邮件很可能会被收件人标记为垃圾邮件,直到他们将您的发件人列入白名单


和FWIW,不要编辑核心CodeIgniter文件,您可以通过多种不同的方式提供连接详细信息。

您使用的SMTP端口是什么?我使用的是465端口,正如我发现的指南所建议的那样…我在这些方面非常新。是否有其他文件需要配置端口?您可以接近这两个:var$SMTP\u host="ssl://smtp.googlemail.com“;//SMTP服务器var$SMTP_port=“25”;//SMTP端口我尝试了它,但ssl协议又出现了很多错误……如果我使用没有ssl协议的端口25,我会收到以下消息:220 mx.google.com ESMTP s19sm2428527wik.11-gsmtp hello:250-mx.google.com,为您服务,[85.74.236.143]250-SIZE 35882577 250-8BITMIME 250-STARTTLS 250 ENHANCEDSTATUSCODES无法发送身份验证登录命令。错误:530 5.7.0必须先发出STARTTLS命令。S19SM2428527WIK.11-gsmtp from:530 5.7.0必须先发出STARTTLS命令。S19SM2428527WIK.11-gsmtp和其他内容与我先前发布的消息相同抱歉延迟…我将见鬼,明天我就不在了……只是我使用了相同的配置,但可能错过了其他一些东西。感谢Wolf的帮助……实际上我是用这种格式来声明配置文件的,但我在服务器上遇到了问题,不得不取消对php.ini文件中extension=php_openssl.dll的注释
    var $mailpath      = "/usr/sbin/sendmail";    // Sendmail path
    var $smtp_host     = "ssl://smtp.gmail.com";        // SMTP Server.
    $config = Array(
      'protocol' => 'smtp',
      'smtp_host' => 'ssl://smtp.googlemail.com',
      'smtp_port' => 465,
      'smtp_user' => '<test-account-name>@gmail.com',
      'smtp_pass' => '<test-account-password>',
    );