不工作从codeigniter whit amazon ec2

时间:2016-07-27 14:46:10

标签: php codeigniter amazon-ec2 gmail config

这不能在亚马逊EC2上在线工作,但在当地工作正常。并在EC2配置安全组视图图像中: config EC2 security group

我的配置控制器是:

function SendEmail($Encabezado,$Nota){
    $ci = get_instance();
    $ci->load->library('email');
    $config['protocol']    = "smtp";
    $config['smtp_host'] = "ssl://smtp.gmail.com";
    $config['smtp_port'] = "465";
    $config['smtp_user'] = "mygmail@gmail.com"; 
    $config['smtp_pass'] = "mypass";
    $config['charset'] = "utf-8";
    $config['mailtype'] = "html";
    $config['wordwrap'] = TRUE;
    $config['newline'] = "\r\n";

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

    $ci->email->from('mygmail@gmail.com', 'blabla');
    $list = array('mymail@gmail.com');
    $ci->email->to($list);
    $this->email->reply_to('mygmail@gmail.com', 'Explendid Videos');
    $ci->email->subject($Encabezado);
    $ci->email->message($Nota);
    $ci->email->send();
}
问题是什么?请帮忙? 感谢。

1 个答案:

答案 0 :(得分:0)

Gmail SMTP端口仅为smtp.gmail.com

所以,改变一下:

$config['smtp_host'] = "ssl://smtp.gmail.com";

对此:

$config['smtp_host'] = "smtp.gmail.com";

还尝试将配置EC2安全组SMTP端口从25更改为465,即GMail默认端口。