无法使用codeIgniter从gmail smtp服务器发送电子邮件?

时间:2012-10-31 07:34:18

标签: php codeigniter

我不知道我在哪里做错了。我只关注codeIgniter用户指南。我粘贴控制器代码...............

function do_upload()
{
    $config['upload_path'] = 'C:\xampp\htdocs\upload\application';
    $config['allowed_types'] = 'doc|docx|pdf';
    $config['max_size'] = '10240';

    $this->load->library('upload', $config);

    if ( ! $this->upload->do_upload())
    {
        $error = array('error' => $this->upload->display_errors());

        $this->load->view('upload_form', $error);
    }
    else
    {
        $data = array('upload_data' => $this->upload->data());

        echo "Resume Successfully uploaded to database.............";
    }

    $file = $data['upload_data']['full_path'];

    $config = Array(
      'protocol' => 'smtp',
      'smtp_host' => 'ssl://smtp.googlemail.com',
      'smtp_port' => 465,
      'smtp_user' => '****************', // change it to yours
      'smtp_pass' => '******', // change it to yours
      'mailtype' => 'html',
      'charset' => 'iso-8859-1',
      'wordwrap' => TRUE
    );

      $this->load->library('email', $config);
      $this->email->set_newline("\r\n");
      $this->email->from('*************'); // change it to yours
      $this->email->to('***************'); // change it to yours
      $this->email->subject('Email using Gmail.');
      $this->email->message('Working fine ! !');

      if($this->email->send())
     {
      echo 'Email sent.';
     }
     else
    {
     show_error($this->email->print_debugger());
    }
}
  

遇到以下SMTP错误:185667876无法找到   套接字传输“ssl” - 你忘了启用它吗?   配置PHP?无法发送数据:AUTH LOGIN无法发送AUTH   登录命令。错误:无法发送数据:MAIL FROM:

     

from:遇到以下SMTP错误:无法发送数据:   RCPT TO:

     

to:遇到以下SMTP错误:无法发送数据:   DATA

     

数据:遇到以下SMTP错误:无法发送数据:   User-Agent:CodeIgniter日期:星期三,2012年10月31日08:36:21 +0100来自:   返回路径:收件人:test@example.com主题:   =?iso-8859-1?Q?Email_using_Gmail。?=回复:“test@example.com”X-Sender:   test@example.com X-Mailer:CodeIgniter X-Priority:3   (正常)消息ID:< 5090d4f5df7bb@gmail.com>哑剧版:1.0   内容类型:multipart / alternative;边界= “B_ALT_5090d4f5df7d8”   这是MIME格式的多部分消息。您的电邮申请表   可能不支持这种格式。 --B_ALT_5090d4f5df7d8内容类型:   文本/无格式; charset = iso-8859-1 Content-Transfer-Encoding:8bit Working   好的! ! --B_ALT_5090d4f5df7d8 Content-Type:text / html;   charset = iso-8859-1 Content-Transfer-Encoding:quoted-printable Working   好的! ! --B_ALT_5090d4f5df7d8--无法发送数据:。

     

遇到以下SMTP错误:无法使用发送电子邮件   PHP SMTP。您的服务器可能未配置为使用此服务器发送邮件   方法

1 个答案:

答案 0 :(得分:2)

男...你应该先尝试上传,一旦完成,你会尝试解决电子邮件问题。你不需要它:'smtp_host'=> ' ssl:// smtp.googlemail.com' ssl:// part