使用gmail,codeigniter,wamp localhost发送邮件 [英] sending mail using gmail , codeigniter ,wamp localhost

查看:141
本文介绍了使用gmail,codeigniter,wamp localhost发送邮件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用 wamp server 发送电子邮件有问题。我得到这个错误:

  220 smtp.gmail.com ESMTP s10sm40910411wjp.3  -  gsmtp 
hello:250-smtp.gmail.com为您服务,[151.232.116.37]
250-SIZE 35882577
250-8BITMIME
250-STARTTLS
250-ENHANCEDSTATUSCODES
250 -PIPELINING
250-CHUNKING
250 SMTPUTF8
无法发送AUTH LOGIN命令。错误:530 5.7.0必须首先发出STARTTLS命令。 s10sm40910411wjp.3 - gsmtp
无法使用PHP SMTP发送电子邮件。您的服务器可能未配置为使用此方法发送邮件。

这是 codeigniter contoller : >

  class SendEmail extends CI_Controller {
public function index(){

$ config =阵列();
$ config ['protocol'] ='smtp';
$ config ['smtp_host'] ='smtp.gmail.com';
$ config ['smtp_port'] = 465;
$ config ['smtp_user'] ='test@gmail.com';
$ config ['smtp_pass'] ='pass';
$ config ['charset'] ='utf-8';
$ config ['wordwrap'] = TRUE;
$ config ['validate'] = TRUE;
$ config ['_ smtp_auth'] = TRUE;
$ config ['smtp_crypto'] ='ssl';

$ this-> load-> library('email');
$ this-> email-> initialize($ config); ('mytest@gmail.com','test');
$ this-> email->;
$ this-> email->改为('mytest@gmail.com');
$ this-> email->主题(This is Another Email test mail);
$ this->电子邮件>消息(这是电子邮件是为你测试的!我的!神不止......);
if($ this-> email-> send()){
echo'You Are Luck!';
}
else {
echo $ this-> email-> print_debugger();
}
}

现在我不知道问题所在gmail或我的 wamp localhost ,这是配置wamp服务器 php.ini sendmail。 ini (我下载了sendmail.zip文件并将其解压到wamp64 \ sendmail中)。它是我的 php.ini sendmail.ini 配置文件

  php.ini file:
smtp_port = 465
sendmail_path =\D:\wamp64\sendmail\sendmail.exe\-t


$ b $ pre $ sendmail.ini文件
auth_username = test@gmail.com
auth_password = test $ b $ smtp_server = smtp.gmail.com
smtp_port = 465


解决方案

您可能忘记启用IMAP(也启用SMTP)访问您的Gmail帐户。


I have problem to send email using wamp server.I got this error:

220 smtp.gmail.com ESMTP s10sm40910411wjp.3 - gsmtp 
hello: 250-smtp.gmail.com at your service, [151.232.116.37]
250-SIZE 35882577
250-8BITMIME
250-STARTTLS
250-ENHANCEDSTATUSCODES
250-PIPELINING
250-CHUNKING
250 SMTPUTF8
Failed to send AUTH LOGIN command. Error: 530 5.7.0 Must issue a STARTTLS command first. s10sm40910411wjp.3 - gsmtp 
Unable to send email using PHP SMTP. Your server might not be configured to send mail using this method.

And this is codeigniter contoller:

class SendEmail extends CI_Controller{
public function index(){

    $config=array();
    $config['protocol' ]   = 'smtp'                         ;
    $config['smtp_host']   = 'smtp.gmail.com'               ;
    $config['smtp_port']   = 465                            ;
    $config['smtp_user']   = 'test@gmail.com' ;
    $config['smtp_pass']   = 'pass'           ;
    $config['charset'  ]   = 'utf-8'                        ;
    $config['wordwrap' ]   = TRUE                           ;
    $config['validate']    = TRUE                           ;
    $config['_smtp_auth']  = TRUE                           ;
    $config['smtp_crypto'] = 'ssl'                          ;

    $this->load->library('email');
    $this->email->initialize($config);
    $this->email->from('mytest@gmail.com', 'test');
    $this->email->to('mytest@gmail.com');
    $this->email->subject("This is Another Email test  mail");
    $this->email->message("This is email is test for you mr me!the god is more than...");
    if($this->email->send()){
        echo 'You Are Luck!';
    }
    else{
        echo $this->email->print_debugger();
    }
}

Now I don't know that the problem is by gmail or my wamp localhost and this is config of wamp server php.ini and sendmail.ini (I download
sendmail.zip file and extract it into to the wamp64\sendmail).It is my php.ini and sendmail.ini config

php.ini file:
smtp_port = 465
sendmail_path = "\ "D:\wamp64\sendmail\sendmail.exe\" -t"

And

sendmail.ini file:
auth_username=test@gmail.com
auth_password=test
smtp_server= smtp.gmail.com
smtp_port= 465

解决方案

You might have forgotten to enable IMAP (which also enables SMTP) access to your Gmail account.

这篇关于使用gmail,codeigniter,wamp localhost发送邮件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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