send mail in codeigniter through live server

codeigniter send email without smtp
codeigniter smtp email not working
how to send email in codeigniter using gmail smtp
codeigniter send html email
codeigniter send email->from localhost
unable to send email using php mail() codeigniter
codeigniter send email with attachment
send mail in codeigniter using phpmailer

I am trying to send email in codeignter as written in codeigniter documentation... But getting ERROR (Unable to send email using PHP mail(). Your server might not be configured to send mail using this method.)

code---

 $this->load->library('email');

    $this->email->from('***@gmail.com');
    $this->email->to('***@gmail.com');

    $this->email->subject('Email Test');
    $this->email->message('Testing the email class.');

    $this->email->send();

    echo $this->email->print_debugger();

Error---

Unable to send email using PHP mail(). Your server might not be configured to send mail using this method.
Date: Tue, 11 Sep 2018 06:47:46 +0000
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: <5b976512c0d0b@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.

I Know this question might be duplicate but i didn't find any solution from any questions which were asked here...


You have not initialized the email config setting in your code

$this->email->initialize($config);

$this->load->library('email');
$config = Array(
                'protocol' => 'smtp',
                'smtp_host' => 'tls://smtp.gmail.com',
                'smtp_port' => 587,
                'smtp_user' => '******', // your email
                'smtp_pass' => '*****', // your password
                'smtp_timeout'=>20,
                'mailtype' => 'text',
                'charset' => 'iso-8859-1',
                'newline'=>"\r\n",
                'wordwrap' => TRUE
               );

 $this->email->initialize($config);
 $this->email->from('***@gmail.com');
 $this->email->to('***@gmail.com');
 $this->email->subject('Email Test');
 $this->email->message('Testing the email class.');  
 $this->email->send();
 echo $this->email->print_debugger();

This must work for you.

send mail in codeigniter through live server, $this->email->initialize($config); $this->load->library('email'); $config = Array( 'protocol' => 'smtp', 'smtp_host' => 'tls://smtp.gmail.com', 'smtp_port' => 587, 'smtp_user' => '******', // your email 'smtp_pass' => '*****', // your password 'smtp_timeout'=>20, 'mailtype' => 'text', 'charset' => 'iso-8859-1', ' In this article, I will describe how to send emails in a CodeIgniter application using SMTP. I will use the well known and maintained email sending class. You might be interested in: How To Create A REST API In CodeIgniter. Load CodeIgniter’s Email Class. First, load the CodeIgniter’s email library through the following code snippet:


Please check email.php (application\config), Maybe there a problem with your configuration Check email, like SMTP setting

You can add some config variables like the protocol. You can choose from mail, send mail or SMTP. So, obviously, I picked mail since I cannot use send mail or SMTP. You will end up with something like this:

$config['protocol'] = 'mail';
$this->email->initialize($config);

email in codeigniter works fine in localhost, but not working on live , I am using codeigniter email library to send email. the code runs fine in use following approach to send email from localhost and live server  Also, you can send email via SMTP server using CodeIgniter Email library. In this tutorial, we will show how you can send HTML email via SMTP server in CodeIgniter application. The CodeIgniter email library will be used to send email using SMTP server. Send email via SMTP server in CodeIgniter. At first include the CodeIgniter email library.


Maybe there's a problem with your configuration. You have to set some preferences in the config file.

$config['protocol'] = 'sendmail';

And you have to initialize the config

$this->email->initialize($config);

SMTP Mail not sending, I'm having issues in sending mail through SMTP Protocol. Your server might not be configured to send mail using this method. Date: Fri, 29  You also configure the preferences regarding email in CodeIgniter. CodeIgniter provides following features for sending emails −. Multiple Protocols − Mail, Sendmail, and SMTP. TLS and SSL Encryption for SMTP. Multiple recipients. CC and BCCs. HTML or Plaintext email. Attachments.


            $config['protocol'] = 'smtp';

            $config['smtp_host'] = 'mail.domain.com';

            $config['smtp_port'] = '587';

            $config['smtp_timeout'] = '7';

            $config['smtp_user'] = 'info@domain.com';

            $config['smtp_pass'] = '*******';

            $config['charset'] = 'utf-8';

            $config['newline'] = "\r\n";

            $config['mailtype'] = 'html'; // or html

            $config['validation'] = TRUE; // bool whether to validate email or not      

            $this->email->initialize($config);
            $this->email->from('info@domain.com', 'Name');
            $this->email->to($emailTo);


            $this->email->subject('Reset your password');

            $body = $this->load->view('forgotmailer', $data, TRUE);

            $this->email->message($body);


            $this->email->send();

...................................................................

$this->load->library('email'); //add Library

How to Send Email using CodeIgniter, CodeIgniter makes it super easy for us to send emails from our application This should be a valid email address that exists on the server  Alternatively, PHPMailer library is the best option to send email via SMTP server without using the CodeIgniter default Email library. Generally, PHPMailer library is used to send email with SMTP server in PHP. You can also use the PHPMailer library in CodeIgniter framework to send email using SMTP server.


Send Email in CodeIgniter With SMTP, In this article, I will describe how to send emails in a CodeIgniter application using SMTP. I will use the well known and maintained email sending  Email is nothing but an Electronic mail. It is a method in which an author can exchange digital messages from one or more recipients. Here in this post by the use of CodeIgniter’s inbuilt email class you will learn how one can use this CI email library to send emails via multiple protocols (mail, Sendmail, and SMTP).


How to send email from live server/c panel using php., In this video i am trying to show how to send mail from live server/C panel using php mail Duration: 5:24 Posted: Dec 6, 2018 Email Class¶ CodeIgniter’s robust Email Class supports the following features: Multiple Protocols: Mail, Sendmail, and SMTP; TLS and SSL Encryption for SMTP; Multiple recipients; CC and BCCs; HTML or Plaintext email; Attachments; Word wrapping; Priorities; BCC Batch Mode, enabling large email lists to be broken into small BCC batches. Email Debugging tools


How to Send Email Through Gmail With CodeIgniter, Enable SSL on your Web server to connect to Gmail's servers and send your password securely. Open "php.ini" on your Web server and uncomment the following  Send Mail Using Contact Form With PHPMailer and Gmail SMTP On Live Hosting Server - Duration: 20:49. DCodeMania 68,909 views