Venkata Krishna
Venkata Krishna

Reputation: 4305

unable to send email from gmail smtp server using codeIgniter?

I don't know where i am doing wrong. I am following codeIgniter user guide only. I pasting code of controller...............

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());
    }
}

The following SMTP error was encountered: 185667876 Unable to find the socket transport "ssl" - did you forget to enable it when you configured PHP? Unable to send data: AUTH LOGIN Failed to send AUTH LOGIN command. Error: Unable to send data: MAIL FROM:

from: The following SMTP error was encountered: Unable to send data: RCPT TO:

to: The following SMTP error was encountered: Unable to send data: DATA

data: The following SMTP error was encountered: Unable to send data: User-Agent: CodeIgniter Date: Wed, 31 Oct 2012 08:36:21 +0100 From: Return-Path: To: [email protected] Subject: =?iso-8859-1?Q?Email_using_Gmail.?= Reply-To: "[email protected]" X-Sender: [email protected] X-Mailer: CodeIgniter X-Priority: 3 (Normal) Message-ID: <[email protected]> Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="B_ALT_5090d4f5df7d8" This is a multi-part message in MIME format. Your email application may not support this format. --B_ALT_5090d4f5df7d8 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit Working fine ! ! --B_ALT_5090d4f5df7d8 Content-Type: text/html; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable Working fine ! ! --B_ALT_5090d4f5df7d8-- Unable to send data: .

The following SMTP error was encountered: Unable to send email using PHP SMTP. Your server might not be configured to send mail using this method.

Upvotes: 1

Views: 3903

Answers (1)

Jonas Erik Barreto
Jonas Erik Barreto

Reputation: 290

Man... You should try upload first, when it get done, you try to solve the e-mail problem. And you dont need it: 'smtp_host' => ' ssl:// smtp.googlemail.com' the ssl:// part

Upvotes: 2

Related Questions