WEBVTT

NOTE Created by CaptionSync from Automatic Sync Technologies www.automaticsync.com

00:00:01.086 --> 00:00:04.816 align:middle
Previewing emails in the
profiler is okay for basic emails,

00:00:05.096 --> 00:00:08.806 align:middle
but soon we'll add HTML styles
and images of space cats.

00:00:09.096 --> 00:00:12.526 align:middle
To properly see how our emails
look, we need a more robust tool.

00:00:13.026 --> 00:00:15.536 align:middle
We're going to use Mailtrap's
email testing tool.

00:00:15.976 --> 00:00:20.676 align:middle
This gives us a real SMTP server that we can
connect to, but instead of delivering emails

00:00:20.676 --> 00:00:24.546 align:middle
to real inboxes, they go into a
fake inbox that we can check out!

00:00:25.106 --> 00:00:28.886 align:middle
It's like we send an email for real, then
hack that person's account to see it...

00:00:28.886 --> 00:00:31.306 align:middle
but without the hassle or
all that illegal stuff!

00:00:31.306 --> 00:00:35.356 align:middle
Go to https://mailtrap.io and
sign up for a free account.

00:00:35.916 --> 00:00:38.966 align:middle
Their free tier plan has some limits
but is perfect for getting started.

00:00:39.526 --> 00:00:41.846 align:middle
Once you're in, you'll be on their app homepage.

00:00:42.276 --> 00:00:45.816 align:middle
What we're interested in right now
is email testing, so click that.

00:00:46.526 --> 00:00:48.006 align:middle
You should see something like this.

00:00:48.346 --> 00:00:50.936 align:middle
If you don't have an inbox yet, add one here.

00:00:51.596 --> 00:00:53.206 align:middle
Open that shiny new inbox.

00:00:53.906 --> 00:00:58.396 align:middle
Next, we need to configure our app to
send emails via the Mailtrap SMTP server.

00:00:58.806 --> 00:00:59.556 align:middle
This is easy!

00:00:59.946 --> 00:01:03.796 align:middle
Down here, under "Code Examples",
click "PHP" then "Symfony".

00:01:04.746 --> 00:01:06.066 align:middle
Copy the MAILER_DSN.

00:01:06.686 --> 00:01:10.246 align:middle
Because this is a sensitive value,
and may vary between developers,

00:01:10.556 --> 00:01:13.286 align:middle
don't add it to .env as that's commited to git.

00:01:13.846 --> 00:01:18.276 align:middle
Instead, create a new .env.local
file at the root of your project.

00:01:18.866 --> 00:01:22.506 align:middle
Paste the MAILER_DSN here to
override the value in .env.

00:01:23.466 --> 00:01:25.366 align:middle
We are set up for Mailtrap testing!

00:01:25.816 --> 00:01:26.496 align:middle
That was easy!

00:01:26.826 --> 00:01:27.506 align:middle
Test'r out!

00:01:28.136 --> 00:01:33.146 align:middle
Back in the app, book a new
trip: Name: Steve, Email:

00:01:33.146 --> 00:01:36.896 align:middle
steve@minecraft.com, any
date in the future, and...

00:01:37.086 --> 00:01:40.626 align:middle
book! This request takes a bit
longer because it's connecting

00:01:40.626 --> 00:01:43.026 align:middle
to the external Mailtrap SMTP server.

00:01:43.676 --> 00:01:45.596 align:middle
Back in Mailtrap, bam!

00:01:45.846 --> 00:01:47.706 align:middle
The email's already in our inbox!

00:01:48.036 --> 00:01:48.946 align:middle
Click to check it out.

00:01:49.656 --> 00:01:51.786 align:middle
Here's a "Text" preview and a "Raw" view.

00:01:52.416 --> 00:01:55.296 align:middle
There's also a "Spam Analysis" - cool!

00:01:56.086 --> 00:02:00.006 align:middle
"Tech Info" shows all the nerdy "email
headers" in an easy-to-read format.

00:02:00.626 --> 00:02:05.236 align:middle
These "HTML" tabs are greyed out because we
don't have an HTML version of our email...

00:02:05.586 --> 00:02:07.596 align:middle
yet... Let's change that next!

