OiO.lk Community platform!

Oio.lk is an excellent forum for developers, providing a wide range of resources, discussions, and support for those in the developer community. Join oio.lk today to connect with like-minded professionals, share insights, and stay updated on the latest trends and technologies in the development field.
  You need to log in or register to access the solved answers to this problem.
  • You have reached the maximum number of guest views allowed
  • Please register below to remove this limitation

An Error Was Encountered Unable to send email using PHP mail(). Your server might not be configured to send mail using this method

  • Thread starter Thread starter user11692616
  • Start date Start date
U

user11692616

Guest
I'm trying to sending an email using CodeIgniter via Gmail SMTP but the function is not working it is showing me this error on the localhost?

Code:
An Error Was Encountered Unable to send email using PHP mail(). 
Your server might not be configured to send mail using this method.

Here my email function

Code:
$config = Array(
        'protocol' => 'smtp',
        'smtp_host' => 'ssl://smtp.googlemail.com',
        'smtp_port' => 465,
        'smtp_user' => '******@gmail.com', // change it to yours
        'smtp_pass' => '**********', // change it to yours
        'mailtype' => 'html',
        'charset' => 'iso-8859-1',
        'wordwrap' => TRUE
    );

    $message = 'Test';
    $this->load->library('email', $config);
    $this->email->set_newline("\r\n");
    $this->email->from('*********@gmail.com'); // change it to yours
    $this->email->to('[email protected]');// change it to yours
    $this->email->subject('Resume from JobsBuddy for your Job posting');
    $this->email->message($message);
    if($this->email->send())
    {
        echo 'Email sent.';
    }
    else
    {
        show_error($this->email->print_debugger());
    }
<p>I'm trying to sending an email using CodeIgniter via Gmail SMTP but the function is not working it is showing me this error on the localhost?</p>
<pre><code>An Error Was Encountered Unable to send email using PHP mail().
Your server might not be configured to send mail using this method.
</code></pre>
<p><strong>Here my email function</strong></p>
<pre><code>$config = Array(
'protocol' => 'smtp',
'smtp_host' => 'ssl://smtp.googlemail.com',
'smtp_port' => 465,
'smtp_user' => '******@gmail.com', // change it to yours
'smtp_pass' => '**********', // change it to yours
'mailtype' => 'html',
'charset' => 'iso-8859-1',
'wordwrap' => TRUE
);

$message = 'Test';
$this->load->library('email', $config);
$this->email->set_newline("\r\n");
$this->email->from('*********@gmail.com'); // change it to yours
$this->email->to('[email protected]');// change it to yours
$this->email->subject('Resume from JobsBuddy for your Job posting');
$this->email->message($message);
if($this->email->send())
{
echo 'Email sent.';
}
else
{
show_error($this->email->print_debugger());
}
</code></pre>
Continue reading...
 

Latest posts

J
Replies
0
Views
1
Jeff P Chacko
J
Top