【问题标题】:Send SMTP email from cpanel从 cpanel 发送 SMTP 电子邮件
【发布时间】:2016-09-29 12:09:37
【问题描述】:

我正在使用 godaddy 共享主机,我读到无法使用 SMTP 从共享主机发送电子邮件是否有任何替代方法.. 我正在尝试使用 codeigniter 发送电子邮件,但它根本不起作用

$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;
                }

【问题讨论】:

    标签: php codeigniter email


    【解决方案1】:

    检查: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' => 'youremail@yourdomain.com',
        '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()
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2011-07-30
      • 2014-04-04
      • 2015-10-21
      • 2013-12-31
      • 2012-06-23
      • 2020-11-03
      • 2017-02-11
      • 1970-01-01
      相关资源
      最近更新 更多