> Symfony 5 >

Course Overview

Login to bookmark this course

Symfony Mailer: Love Sending Emails Again

Become a pro at sending app emails, using Symfony's Mailer. Learn debugging, email attachments and production cloud delivery setup!

  • 3646 students
  • EN Captions
  • EN Script
  • Certificate of Completion

Your Guides

About this course

This tutorial is built on Symfony 4.3, but will work well with Symfony 4.4 or 5.

What PHP libraries does this tutorial use?

// composer.json
    "require": {
        "php": "^7.1.3",
        "ext-iconv": "*",
        "aws/aws-sdk-php": "^3.87", // 3.110.11
        "composer/package-versions-deprecated": "^1.11", // 1.11.99
        "doctrine/annotations": "^1.0", // 1.10.1
        "doctrine/doctrine-bundle": "^1.6.10", // 1.11.2
        "doctrine/doctrine-migrations-bundle": "^1.3|^2.0", // v2.0.0
        "doctrine/orm": "^2.5.11", // v2.7.2
        "knplabs/knp-markdown-bundle": "^1.7", // 1.7.1
        "knplabs/knp-paginator-bundle": "^2.7", // v2.8.0
        "knplabs/knp-snappy-bundle": "^1.6", // v1.6.0
        "knplabs/knp-time-bundle": "^1.8", // v1.9.1
        "league/flysystem-aws-s3-v3": "^1.0", // 1.0.23
        "league/flysystem-cached-adapter": "^1.0", // 1.0.9
        "league/html-to-markdown": "^4.8", // 4.8.2
        "liip/imagine-bundle": "^2.1", // 2.1.0
        "nexylan/slack-bundle": "^2.1,<2.2.0", // v2.1.0
        "oneup/flysystem-bundle": "^3.0", // 3.1.0
        "php-http/guzzle6-adapter": "^1.1", // v1.1.1
        "phpdocumentor/reflection-docblock": "^3.0|^4.0", // 4.3.1
        "sensio/framework-extra-bundle": "^5.1", // v5.4.1
        "stof/doctrine-extensions-bundle": "^1.3", // v1.3.0
        "symfony/asset": "^4.0", // v4.3.4
        "symfony/console": "^4.0", // v4.3.4
        "symfony/flex": "^1.9", // v1.21.6
        "symfony/form": "^4.0", // v4.3.4
        "symfony/framework-bundle": "^4.0", // v4.3.4
        "symfony/mailer": "4.3.*", // v4.3.4
        "symfony/messenger": "4.3.*", // v4.3.4
        "symfony/property-access": "4.3.*", // v4.3.4
        "symfony/property-info": "4.3.*", // v4.3.4
        "symfony/security-bundle": "^4.0", // v4.3.4
        "symfony/sendgrid-mailer": "4.3.*", // v4.3.4
        "symfony/serializer": "4.3.*", // v4.3.4
        "symfony/twig-bundle": "^4.0", // v4.3.4
        "symfony/validator": "^4.0", // v4.3.4
        "symfony/web-server-bundle": "^4.0", // v4.3.4
        "symfony/webpack-encore-bundle": "^1.4", // v1.6.2
        "symfony/yaml": "^4.0", // v4.3.4
        "twig/cssinliner-extra": "^2.12", // v2.12.0
        "twig/extensions": "^1.5", // v1.5.4
        "twig/extra-bundle": "^2.12|^3.0", // v2.12.1
        "twig/inky-extra": "^2.12", // v2.12.0
        "twig/twig": "^2.12|^3.0" // v2.13.1
    "require-dev": {
        "doctrine/doctrine-fixtures-bundle": "^3.0", // 3.2.2
        "easycorp/easy-log-handler": "^1.0.2", // v1.0.7
        "fzaninotto/faker": "^1.7", // v1.8.0
        "symfony/browser-kit": "4.3.*", // v4.3.5
        "symfony/debug-bundle": "^3.3|^4.0", // v4.3.4
        "symfony/dotenv": "^4.0", // v4.3.4
        "symfony/maker-bundle": "^1.0", // v1.13.0
        "symfony/monolog-bundle": "^3.0", // v3.4.0
        "symfony/phpunit-bridge": "^3.3|^4.0", // v4.3.4
        "symfony/stopwatch": "4.3.*", // v4.3.4
        "symfony/var-dumper": "^3.3|^4.0", // v4.3.4
        "symfony/web-profiler-bundle": "4.3.*" // v4.3.4

Yep! No matter how hard you try, eventually you will need to send emails from your app! Whether it's a "registration" email, "order completed" email or a "Hey, we think you're great & want to give you a free ?" email, setting this up doesn't need to be a pain! With Symfony's Mailer component & cloud email delivery services... I dare say, you're going to love sending emails.

In this tutorial, we'll give your emails something to brag about by mastering Symfony's Mailer:

  • Installing & configuring the mailer transport
  • Sending that first email and configuring the heck out of it!
  • Debugging emails while developing? Hello Mailtrap, MailHog & Mailcatcher!
  • HTML emails with Twig
  • Automatic text emails
  • Linking to images from within an email vs embedded images
  • Styling with CSS with automatic CSS inlining
  • Integrating the Foundation CSS framework for emails: Inky!
  • Leveraging event listeners to globally customize from, senders, etc
  • Sending emails from a command (and fixing link URLs)
  • Email attachments
  • Sending emails from inside of tests (the null transport)
  • Async email sending with Messenger
  • Failover & round robin transports
  • Production cloud delivery setup with SendGrid
  • DNS "deliverability" goodies - SPF, DKIM & DMARC!

So... let's send some emails, make them look great and love the process.

Next courses in the Symfony 5: Learn More Tricks section of the Symfony 5 Track!


Sort By
Login or Register to join the conversation

Hi, i want ask that everywhere is all about sending emails... What is great.. i used many tips from your tutorial... But is some place where i can create inbox and manage it for users??? Mean if you can suggest something for beginner for basic easy integration, that i will not only available sent email but receive and store/manage them in inbox in symfony.

| Reply |

Hey Miky!

Hmm. Let me make sure I understand correctly :). Do you need a place where you can send and receive emails to customers? If so, we use Helpscout for this. It is not integrated specifically inside our Symfony app in any significant way, but we love it. Our codebase sends emails from hello@symfonycasts.com. If anyone replies to any email, we have Helpscout configured so that the messages appear in Helpscout. Then, our entire team can read & reply to those messages. I'm not sure if this is what you're looking for - but let me know. If you ARE looking for a system like this, I would highly recommend using a service like Helpscout vs trying to implement something custom in your Symfony app, because services like Helpscout are so feature-rich (it's all they do!).


| Reply |

Hi, we looked on it... and its great.. but the request is small internal local stored emails loaded from mailbox and saved into database to do whatever we want with them... We are looking now on https://github.com/knyk/mai... but i was not sure if exist mailer if exist some "official" version of something which support also receiving of emails, not only sending... Thank you for your answer :)

| Reply |

Hey Miky!

Ah, nice find! Yes, unfortunately, you are not "missing" some cool official feature for this - you would need to build it yourself or use some bundle :).

Good luck!

| Reply |
Mouad E. avatar Mouad E. 4 years ago

Hi, thanks for the hard work, every time you finish a course, i say now they will release symfony translation but still nothing about it, do you still working on it or canceled?

thank you.

| Reply |

Hey Adam!

Thank you for your interest in Translations tutorial! We're sorry about the delay, but we're going to release it, it's NOT canceled. It was just postpone, first of all because some new upcoming version of Symfony should have a lot of good improvements that we would like to cover in this screencast, and also the 2nd reason is that we wanted to cover translations in full, like from translating things in your templates and up to translating content in the DB - it seems to be a big tutorial, or even probably a few smaller courses in Translation series. So, it was just postponed, for now we're working on a few new things like Mailer and Blackfire... and maybe one more JS tutorial. And since there's Symfony 5 upcoming pretty soon, so we're not sure if we should wait a bit more and cover this translations tutorial on Symfony 5 or release it faster but on Symfony 4. In any case it would depend on our availability, there're a lot of interesting screencasts are coming soon on SymfonyCasts. But we're interested in your opinion. What would you prefer? Cover translations on Symfony 4 faster or wait for Symfony 5 and cover it on the latest version?

Thank you for your patience!


| Reply |
Default user avatar moktar 4 years ago

Hello, How much i need to wait until the next videos will Come ??? please finish it

| Reply |

Hey Moktar,

This course is just in the middle of releasing. We're still working on recording audio and video parts of it and then mix them together. We're trying to release a new video every day, you can see it on our Course Updates page: https://symfonycasts.com/up...

We're sorry for any inconvenience it may cause for you, but believe us, we do our best on it. And that's our policy about releasing new videos, we do want to deliver the content quicker for our customers, that's why we decided to release our videos step by step when they are ready instead of letting people wait until the complete course is ready and publish the entire course at once. This let us an ability to publish first videos of the course faster even when we're still working on the end of this course.

I hope this makes sense for you and thank you for your patience!


| Reply |
Bartlomeij avatar Bartlomeij 4 years ago

When do you plan to release that tutorial? Can't wait for it!

| Reply |

Hey Bartlomeij!

This is coming tomorrow (Monday). And... it's super fun :).


| Reply |

Delete comment?

Share this comment

astronaut with balloons in space

"Houston: no signs of life"
Start the conversation!