代码之家  ›  专栏  ›  技术社区  ›  Ghafor Yaqubi

无法通过live server上的codeigniter发送邮件[重复]

  •  0
  • Ghafor Yaqubi  · 技术社区  · 6 年前

    我在stackoverflow上尝试了很多东西,但仍然无法发送邮件,可能是我的配置错误;代码正在实时服务器中运行

          public function(){
        // configuration
        $config = Array(
          'protocol' => 'smtp',
          'smtp_host' => 'ssl://smtp.googlemail.com',
          'smtp_port' => 465,
          'smtp_user' => 'my_email', 
          'smtp_pass' => 'my_password', 
          'mailtype' => 'html',
          'charset'  => 'iso-8859-1',
          'wordwrap'   => true
    
        );
        $this->load->library('email',$config);
        $this->email->from('my_email','Administrator');
        $this->email->to('my_friends_email');
        $this->email->subject($subject);
        $this->email->message($message);
        return ($this->email->send()); }
    
    2 回复  |  直到 6 年前
        1
  •  1
  •   Siddhartha esunuri    6 年前

    试试这个

    $config = Array(
    'protocol' => 'smtp',
    'smtp_host' => 'ssl://smtp.googlemail.com',
    'smtp_port' => 465,
    'smtp_user' => 'xxx',
    'smtp_pass' => 'xxx',
    'mailtype'  => 'html', 
    'charset'   => 'iso-8859-1'
    );
    $this->load->library('email', $config);
    $this->email->set_newline("\r\n");
    
    // Set to, from, message, etc.
    
    $result = $this->email->send();
    
        2
  •  0
  •   snowflakes    6 年前

    如果托管帐户中允许使用STMP中继或外部SMTP,则需要与服务器提供商进行检查。