Docker Community Forums

Share and learn in the Docker community.

Container in laradock not sending emails


(Memowii) #1

I’m using laradock with two containers, apache2 and mysql. I copied and pasted my codeigniter project that I had in a virtual machine, my problem happens when I want to send an email using codeigniter’s Email class.

This is my function:

public function send_email($from_email, $from_name, $reply_to_email, $reply_to_name, $to_email, $subject, $message)
    $this->email->from($from_email, $from_name);
    $this->email->reply_to($reply_to_email, $reply_to_name);

This is how I used that function:

$this->send_email('', 'memo wii', '',
    'memo wii', '', 'prueba', 'hola memogl');

I'm always getting these errors:

A PHP Error was encountered

Severity: Warning

Message: fsockopen(): unable to connect to (No route to host)

Filename: libraries/Email.php

This is another error:

A PHP Error was encountered

Severity: Warning

Message: fwrite() expects parameter 1 to be resource, boolean given

Filename: libraries/Email.php

Line Number: 1847

Any idea about how to solve it?


  • I’m using codeigniter 2
  • My docker version is Docker version 18.03.1-ce, build 9ee9f40
  • I use docker-compose up --build apache2 mysql to run my containers