Sending emails with Codeigniter

1

I'm stuck with this, I have the following driver:

function prueba_envio_email()
 {
    $config = Array(
        'protocol' => 'smtp',
        'smtp_host' => 'ssl://smtp.googlemail.com',
        'smtp_port' => 465,
        'smtp_user' => '[email protected]',
        'smtp_pass' => 'micontrasena'
    );

    $this->load->library('email',$config);
    $this->email->set_newline("\r\n");

    $this->email->from('[email protected]');
    $this->email->to('[email protected]');
    $this->email->subject('Email test');
    $this->email->message('It is working!');

    if ($this->email->send())
    {
        echo "email enviado";
    }
    else
    {
        show_error($this->email->print_debugger());
    }

 }

Following a YouTube tutorial, I modified a couple of files.

php.ini and sendmail.ini in the XAMPP folder.

From sendmail.ini

smtp_server=smtp.gmail.com
smtp_port=587
[email protected]
auth_password=micontrasena

And the php.ini

sendmail_path="\"C:\xampp\sendmail\sendmail.exe" -t"

I have also tried to send it with port 465, which I had seen elsewhere.

And I have tried to do it in two ways, using the codeigniter driver and using a simple php file with this content:

<?php

$message = "hola que tal estas";
$headers = "From: [email protected]";
mail("micorreoelectronico","Testing", $message, $headers);
echo "test hecho por mi";

?>

In the end I get the driver to return the message that the email has been sent, both the "autoenvio" to my gmail mail and another that I have hotmail but nothing comes to me.

I have also looked at some forum posts but there is different and diffuse information. Or so I think.

Does anyone who has worked with this know where the shots can go? Thanks.

    
asked by ZocrateZ 04.04.2018 в 19:17
source

0 answers