I am trying send email using codeigniter function. I have try this code.
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
public function __construct()
{
parent::__construct();
}
function index()
{
$this->load->library('email');
$this->email->from('praju.rade@gmail.com', 'Your Name');
$this->email->to('praju.rade@gmail.com');
$this->email->subject('Email Test');
$this->email->message('Testing the email class.');
$this->email->send();
//$this->load->view('welcome_message');
}
} ?>
I got this error.
A PHP Error was encountered
Severity: Warning
Message: mail(): Failed to connect to mailserver at "smtp.wlink.com.np" port 25, verify your "SMTP" and "smtp_port" setting in php.ini or use ini_set()
Filename: libraries/Email.php
Line Number: 1553
The error message helps a little to know what happens. You can contact your supplier to provide you information on the SMTP server or set your preferences mail CodeIgniter to not use SMTP they use the native PHP mail function https://codeigniter.com/user_guide/libraries/email.html#email-preferences
You could also use the Gmail SMTP http://www.formget.com/codeigniter-gmail-smtp/