Reputation: 35
In the below codeigniter i want to send a email but i cant send it pls help me.
<?php
/**
* SENDS EMAIL WITH GMAIL
*/
class Email extends CI_Controller
{
function index()
{
$config = Array(
'protocol' => 'smtp',
'smtp_host' => 'ssl://smtp.googlemail.com',
'smtp_port' => 465,
'smtp_user' => '[email protected] ',
'smtp_pass' => 'highschool',
'mailtype' => 'html',
'charset' => 'iso-8859-1'
);
$this->load->library('email', $config);
$this->email->set_newline("\r\n");
$this->email->from('[email protected]', 'moses');
$this->email->to('[email protected]');
$this->email->subject('This is an email test');
$this->email->message('It is working. Great!');
if($this->email->send())
{
echo 'Your email was sent, successfully.';
}
else
{
show_error($this->email->print_debugger());
}
}
}
?>
It is showing error
The following SMTP error was encountered: 65272624 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: Tue, 17 Sep 2013 16:54:03 +0000 From: "moses" Return-Path: To: [email protected] Subject: =?iso-8859-1?Q?This_is_an_email_test?= 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_5238892bc2bbc" This is a multi-part message in MIME format. Your email application may not support this format. --B_ALT_5238892bc2bbc Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit It is working. Great! --B_ALT_5238892bc2bbc Content-Type: text/html; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable It is working. Great! --B_ALT_5238892bc2bbc--
Unable to send data: .
Upvotes: 2
Views: 2778
Reputation: 1
$config = array(
'protocol' => 'smtp',
'smtp_host' => 'ssl://smtp.secureserver.net',
'smtp_port' => 465,
'smtp_auth' => true,
'smtp_user' => 'uername',
'smtp_pass' => 'password',
'mailtype' => 'html',
'charset' => 'iso-8859-1'
);
$this->load->library('email', $config);
Upvotes: 0
Reputation: 3170
This worked for me:
$config = Array(
'protocol' => 'smtp',
'smtp_host' => 'ssl://smtp.googlemail.com',
'smtp_port' => 465,
'smtp_auth' => true,
'smtp_user' => 'xxx',
'smtp_pass' => 'xxx',
'mailtype' => 'html',
'charset' => 'iso-8859-1'
);
$this->load->library('email', $config);
See here for details:http://ellislab.com/forums/viewthread/132443/
Upvotes: 3
Reputation: 1666
Enable: php_openssl.dll
from php.ini, present in your php folder
Upvotes: 2