Welcome Guest, Not a member yet? Register   Sign In
Help with sending email using Xampp
#1

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.
Reply
#2

(This post was last modified: 08-07-2017, 04:34 PM by jarmen_kell.)

I don't feel the necessity of sending a mail thru Gmail's SMTP server using Sendmail.
what I usually do, is just uses CI's built-in Email Class library, configure it to use GMAIL's SMTP,
and execute.

https://www.codeigniter.com/user_guide/l...onfig-file

and it should work
Reply
#3

CodeIgniter : Sending Email via Gmail Using SMTP Protocol
What did you Try? What did you Get? What did you Expect?

Joined CodeIgniter Community 2009.  ( Skype: insitfx )
Reply
#4

Thanks, I have a better understanding now.
Reply
#5

i have the same issue, can u help me? are u manage to resolve this?
Reply




Theme © iAndrew 2016 - Forum software by © MyBB