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

SMTP error on IIS hosting CodeIgniter, can't send email

  • Thread starter Thread starter Master Yoda
  • Start date Start date
M

Master Yoda

Guest
I'm developing a web page, which contains a contact form, all this on CodeIgniter last version. When I try to send a message using Google smtp, it throws me the following error:

Can't send email using smtp PHP, maybe your server is not properly configured to use this send method.

CONTROLLER

Code:
public function send()
{
  $this->load->library('Recaptcha');
   $this->load->library('email');

   if( $this->input->is_ajax_request()){

        $captcha_answer = $this->input->post('g-recaptcha-response');

      $result = $this->validar($captcha_answer);

      if ($result == 1) {
            $mail = $this->input->post('contact_mail');
            $name = $this->input->post('contact_name');
            $msg = $this->input->post('contact_message');


            $config = array(

            'protocol' => 'smtp',
            'smtp_host'=> 'ssl://smtp.googlemail.com',
            'smtp_port'=> 465,
            'smtp_user'=> '[email protected]',
            'smtp_pass'=> '*********',
            'mailtype'=>  'html',
            'charset'=>   'utf-8',
            'newline' =>  '\r\n'
           );

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

           $this->email->from($mail);
           $this->email->to('[email protected]');
           $this->email->from($mail);
           $this->email->subject('IMPORTANTE-CORREO CONTACTO');
           $this->email->message('<h2>PĂGINA NOVADERMA</h2>
                            <hr><br>
                            <br>
                            <p>'.$msg.'</p>
           ');

           if ($this->email->send()) {
             echo json_encode('todo bien wacho');
           }
    }
    else {
    }
   }
}

 public function validar($captcha_answer)
 {    
$this->load->library('Recaptcha');
$response = $this->recaptcha->verifyResponse($captcha_answer);

if ($response['success']) {
    return 1;
  }
  else {
    return 0;
  }
 }

The server is running under IIS...so I have no idea how fix this error, it's an error of CodeIgniter?...any help is useful, cheers.
<p>I'm developing a web page, which contains a contact form, all this on CodeIgniter last version. When I try to send a message using Google smtp, it throws me the following error:</p>
<blockquote>
<p>Can't send email using smtp PHP, maybe your server is not properly configured to use this send method.</p>
</blockquote>
<p>CONTROLLER</p>
<pre><code>public function send()
{
$this->load->library('Recaptcha');
$this->load->library('email');

if( $this->input->is_ajax_request()){

$captcha_answer = $this->input->post('g-recaptcha-response');

$result = $this->validar($captcha_answer);

if ($result == 1) {
$mail = $this->input->post('contact_mail');
$name = $this->input->post('contact_name');
$msg = $this->input->post('contact_message');


$config = array(

'protocol' => 'smtp',
'smtp_host'=> 'ssl://smtp.googlemail.com',
'smtp_port'=> 465,
'smtp_user'=> '[email protected]',
'smtp_pass'=> '*********',
'mailtype'=> 'html',
'charset'=> 'utf-8',
'newline' => '\r\n'
);

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

$this->email->from($mail);
$this->email->to('[email protected]');
$this->email->from($mail);
$this->email->subject('IMPORTANTE-CORREO CONTACTO');
$this->email->message('<h2>PĂGINA NOVADERMA</h2>
<hr><br>
<br>
<p>'.$msg.'</p>
');

if ($this->email->send()) {
echo json_encode('todo bien wacho');
}
}
else {
}
}
}

public function validar($captcha_answer)
{
$this->load->library('Recaptcha');
$response = $this->recaptcha->verifyResponse($captcha_answer);

if ($response['success']) {
return 1;
}
else {
return 0;
}
}
</code></pre>
<p>The server is running under IIS...so I have no idea how fix this error, it's an error of CodeIgniter?...any help is useful, cheers.</p>
Continue reading...
 

Latest posts

D
Replies
0
Views
1
Danish Karmally
D
Top