2016-09-29 24 views
1

我正在使用godaddy共享主机是否存在以及我读取的是不能从共享主机使用SMTP发送电子邮件是否有任何替代方法..我试图使用codeigniter发送电子邮件,但是它不是在所有发送来自cpanel的SMTP电子邮件

$this->email->clear(); 
       $this->email->from($this->config->item('admin_email', 'ion_auth'), $this->config->item('site_title', 'ion_auth')); 
       $this->email->to($user->email); 
       $this->email->subject($this->config->item('site_title', 'ion_auth') . ' - ' . $this->lang->line('email_forgotten_password_subject')); 
       $this->email->message($message); 

       if ($this->email->send()) 
       { 
        $this->set_message('forgot_password_successful'); 
        return TRUE; 
       } 
       else 
       { 
        $this->set_error('forgot_password_unsuccessful'); 
        return FALSE; 
       } 

回答

0

检查工作:GoDaddy POP and SMTP Server Settings

检查库配置电子邮件和您的托管服务提供商寻求创建,选择电子邮件帐户,并查看手动配置。

Documentation Codeigniter Email

<?php 
public function sendEmailSMTP(){ 
    $this->load->library("email"); 
    $configEmail = array(
    'useragent' => "CodeIgniter", 
    'mailpath' => "/usr/bin/sendmail", // or "/usr/sbin/sendmail" 
    'protocol' => 'smtp', 
    'smtp_host' => 'URL',// URL check: http://www.yetesoft.com/free-email-marketing-resources/godaddy-pop-smtp-server-settings/, 
    'smtp_port' => 465, // Usually 465 
    'smtp_crypto' => 'ssl', // or tls 
    'smtp_user' => '[email protected]', 
    'smtp_pass' => 'AccountPasswordEmail', 
    'mailtype' => 'html', 
    'charset' => 'utf-8', 
    'newline' => "\r\n" 
    );  

    //Load config 
    $this->email->initialize($configEmail); 
    $this->email->from($this->config->item('admin_email', 'ion_auth'), $this->config->item('site_title', 'ion_auth')); 
    $this->email->to($user->email); 
    $this->email->subject(($this->config->item('site_title', 'ion_auth') . ' - ' . $this->lang->line('email_forgotten_password_subject')); 
    $this->email->message($message); 
    $this->email->send(); 

    // See result 
    echo $this->email->print_debugger(); 

} // End sendEmailSMTP()