Hello i have a probleme with code igniter mail send here is my code
function __construct()
{
parent::__construct();
$this->load->library('email');
}
function index()
{
$this->load->library('email');
$config = Array(
'protocol' => 'smtp',
'smtp_host' => 'smtp.mailtrap.io',
'smtp_port' => 2525,
'smtp_user' => 'edf81f6d31af91',
'smtp_pass' => '6d824154999158',
'crlf' => "\r\n",
'newline' => "\r\n"
);
$this->email->initialize($config);
$this->email->from('[email protected]', 'Your Name');
$this->email->to('[email protected]');
$this->email->subject('Email Test');
$this->email->message('Testing the email class.');
$this->email->send();
}
and when i execute this code i get this error
A PHP Error was encountered Severity: Warning
Message: fsockopen():
Filename: libraries/Email.php
Line Number: 2055
Backtrace:
File: C:\xampp\htdocs\ctmprod\application\libraries\Email.php Line: 2055 Function: fsockopen
File: C:\xampp\htdocs\ctmprod\application\libraries\Email.php Line: 1950 Function: _smtp_connect
File: C:\xampp\htdocs\ctmprod\application\libraries\Email.php Line: 1825 Function: _send_with_smtp
File: C:\xampp\htdocs\ctmprod\application\libraries\Email.php Line: 1715 Function: _spool_email
File: C:\xampp\htdocs\ctmprod\application\controllers\email.php Line: 51 Function: send
File: C:\xampp\htdocs\ctmprod\index.php Line: 315 Function: require_once
Message: fsockopen():? - ADyson$this->load->library('email');fromindex()method. It is already loaded in constructor. - Tpojka