MailCatcher runs a super simple SMTP server which catches any message sent to it to display in a web interface. Run mailcatcher, set your favourite app to deliver to smtp://127.0.0.1:1025
instead of your default SMTP server, then check out http://127.0.0.1:1080
to see the mail that's arrived so far.
sudo apt-get install -y vim curl python-software-properties lynx nginx
sudo apt-get install -y php5-fpm php5-memcache memcached php-apc
sudo apt-get install -y build-essential libsqlite3-dev ruby1.9.3
sudo gem install mailcatcher
apt-get install ruby-dev
sudo gem install mailcatcher
Then we can can start using Mailcatcher. We'll bind the web interface's IP address to all networks:
mailcatcher --foreground --http-ip=0.0.0.0
This will run Mailcatcher in the foreground. You can exit it by hitting Ctrl+C.
Local scripts can then connect to SMTP at localhost
port 1025
. Additionally, the web interface is available at port 1080
by default.
###Sample Example in Codeigniter
$config = array();
$config['useragent'] = "CodeIgniter";
$config['mailpath'] = "/usr/bin/sendmail"; // or "/usr/sbin/sendmail"
$config['protocol'] = "smtp";
$config['smtp_host'] = "localhost";
$config['smtp_port'] = "1025";
$config['mailtype'] = 'html';
$config['charset'] = 'utf-8';
$config['newline'] = "\r\n";
$config['wordwrap'] = TRUE;
$this->load->library('email');
$this->email->initialize($config);
$this->email->from($fromEmail, $fromName);
$this->email->to($email);
$this->email->subject('Теst Email');
$this->email->message($this->load->view('email/'.$type.'-html', $data, TRUE));