symfony & mailcatcher

17
MAILCATCHER Federico Panini CTO @ fazland.com email : [email protected] LikedIn : https://uk.linkedin.com/in/federicopanini slides : http://www.slideshare.net/FedericoPanini

Upload: federico-panini

Post on 17-Jan-2017

360 views

Category:

Software


2 download

TRANSCRIPT

Page 1: Symfony & Mailcatcher

MAILCATCHER

Federico Panini

CTO @ fazland.comemail : [email protected]

LikedIn : https://uk.linkedin.com/in/federicopaninislides : http://www.slideshare.net/FedericoPanini

Page 2: Symfony & Mailcatcher

[email protected] - CTO

Mailcatcher

Page 3: Symfony & Mailcatcher

[email protected] - CTO

& symfony

The problem we faced over the last months was we’re using in dev and stage environment as mail server the one from our hosting provider…

Mailcatcher

Page 4: Symfony & Mailcatcher

[email protected] - CTO

& symfony

for months we faced these problems :

time latency : we were forced to wait for the emails to come into our inbox seconds / minutes / .. sometimes hours.. internet : as we were sending through our real mail server, sometimes we were flooding it causing a late in the email deliveryinternet : we need an internet connection to test our platform on our dev environmenthosting provider : we had different problems related to the low quality of our mail server provider

Mailcatcher

Page 5: Symfony & Mailcatcher

[email protected] - CTO

& symfony

then we decided to move our mail server to Google fo Business

dedicated email account : we create a dev account as [email protected] this solution cost us MONEY, as real accounts on Google are billed monthlylimitation : the google mail server as a standard policy as a limitation in sending no more than 500 emails per hour. Testing massive email sending lead us to some problemsinternet : we need an internet connection to test our platform on our dev environment

Mailcatcher

Page 6: Symfony & Mailcatcher

[email protected] - CTO

& symfony

ok so Google worked better but it was clear that was not a real / clear solution for the DEVS of Fazland…

What we wanted :

1. Fast email : reading / checking quickly emails sent.2. Free : a solution without costs3. internet : we want to tests email without having an internet

connection

Mailcatcher

Page 7: Symfony & Mailcatcher

[email protected] - CTO

& symfonyMailcatcher

NO MORE PROBLEMS !!

Page 8: Symfony & Mailcatcher

[email protected] - CTO

& symfonyMailcatcher

THE SOLUTION :

Page 9: Symfony & Mailcatcher

[email protected] - CTO

& symfony

What’s Mailcatcher (http://mailcatcher.me/) ?

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.

Mailcatcher

Page 10: Symfony & Mailcatcher

[email protected] - CTO

& symfonyMailcatcher

Catches all mail and stores it for display.Shows HTML, Plain Text and Source version of messages, as applicable.Rewrites HTML enabling display of embedded, inline images/etc and openlinks in a new window.Lists attachments and allows separate downloading of parts.Download original email to view in your native mail client(s).Command line options to override the default SMTP/HTTP IP and port settings.Mail appears instantly if your browser supports WebSockets, otherwise updatesevery thirty seconds.Runs as a daemon run in the background.Sendmail-analogue command, catchmail, makes using mailcatcher fromPHP a lot easier.Written super-simply in EventMachine, easy to dig in and change.Keyboard navigation between messages

Page 11: Symfony & Mailcatcher

[email protected] - CTO

install

sudo gem install mailcatcher

Mailcatcher

Page 12: Symfony & Mailcatcher

[email protected] - CTO

install

mailcatcher —http-ip=0.0.0.0

This command tells mailcather to listen on every port.

Mailcatcher

Page 13: Symfony & Mailcatcher

[email protected] - CTO

install

Mailcatcher after start will be available on port 25 as SMTP server and on port 1080 as WEB mail client to check the email sent through the application.

localhost 25 — SMTP

http://localhost:1080 — SMTP

Mailcatcher

Page 14: Symfony & Mailcatcher

[email protected] - CTO

symfony config

The symfony setup is really easy :

Mailcatcher

parameters: mailer_transport: smtp mailer_host: 127.0.0.1 mailer_port: 1025 mailer_user: null mailer_password: null

Page 15: Symfony & Mailcatcher

[email protected] - CTO

bonus

Setup mailcatcher to boot at startup

Mailcatcher

create a file /etc/init/mailcatcher.conf

start on runlevel [2345]stop on runlevel [!2345]

exec /usr/bin/env $(which mailcatcher) --foreground --http-ip=0.0.0.0

Page 16: Symfony & Mailcatcher

[email protected] - CTO

bonus

sudo service mailcatcher startsudo service mailcatcher stopsudo service mailcatcher restartsudo service mailcatcher status

Mailcatcher

Page 17: Symfony & Mailcatcher

[email protected] - CTO

Mailcatcherreferences

• http://blog.remarkablelabs.com/2013/01/mailcatcher-making-working-with-email-in-development-mode-a-pleasure

• https://gist.github.com/vincentchalamon/840e7f83c20699d546c7• https://serversforhackers.com/setting-up-mailcatcher