Help with sending email using Xampp |
-
michaeldtrek Newbie

-
Posts: 9
Threads: 2
Joined: Jul 2017
Reputation:
0
Code: Hi, I'm new at this and am having trouble in getting this to work. I cannot get CI to send email using Xampp and hopefully someone can help. This is what I have done.
In the C:\xampp\php\php.ini I removed the semicolon from extension=php_openssl.dll
-----
In the in php.ini file I changed [mail function] to the following
SMTP=smtp.gmail.com
smtp_port=465
sendmail_from = [email protected]
sendmail_path = "\"C:\xampp\sendmail\sendmail.exe\" -t"
-----
In the sendmail.ini i chnage the following code
[sendmail]
smtp_server=smtp.gmail.com
smtp_port=465
error_logfile=error.log
debug_logfile=debug.log
[email protected]
auth_password=my-gmail-password
[email protected]
-----
This is my code:
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
class Contact extends MX_Controller
{
public function index()
{
$config = Array(
'protocol' => 'smtp',
'smtp_host' =>'ssl://smtp.googleemail.com',
'smtp_port' => 465,
'smtp_user' => '**********@gmail.com',
'smtp_pass' => '**********',
'mailtype' => 'html',
'charset' => 'utf-8',
'wordwrap' => TRUE
);
$this->load->library('email', $config);
$this->email->set_newline("\r\n");
$this->email->from('[email protected]', 'Michael Foston');
$this->email->to('[email protected]');
$this->email->subject('Email Test');
$this->email->message('Testing the email class.');
if($this->email->send())
{
echo 'your email was sent';
}
else
{
echo $this->email->print_debugger();
}
}
}
------
This is the error I am recieving:
Unable to send email using PHP mail(). Your server might not be configured to send mail using this method.
Date: Mon, 7 Aug 2017 20:18:25 +0200
From: "**********" <**********@gmail.com>
Return-Path: <**********@gmail.com>
Reply-To: <**********@gmail.com>
User-Agent: CodeIgniter
X-Sender: **********@gmail.com
X-Mailer: CodeIgniter
X-Priority: 3 (Normal)
Message-ID: <**********@gmail.com>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
=?UTF-8?Q?Email=20Test?=
Testing the email class.
Thanks.
|
Messages In This Thread |
Help with sending email using Xampp - by michaeldtrek - 08-07-2017, 11:55 AM
|