Chapters
31 Chapters
|
3:19:40
|
Login to bookmark this video
-
Course Code
Subscribe to download the code!Compatible PHP versions: ^7.1.3
Subscribe to download the code!Compatible PHP versions: ^7.1.3
-
This Video
Subscribe to download the video!
Subscribe to download the video!
-
Subtitles
Subscribe to download the subtitles!
Subscribe to download the subtitles!
-
Course Script
Subscribe to download the script!
Subscribe to download the script!
24.
Production Settings with SendGrid
Scroll down to the script below, click on any sentence (including terminal blocks) to jump to that spot in the video!
Subscribe to jump to this part in the video!
Keep on Learning!
If you liked what you've learned so far, dive in! Subscribe to get access to this tutorial plus video, code and script downloads.
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
}
}
16 Comments
Hello after making my code following this tutorial. I find that even if the profiler confirms that my mails get directed towards an external email account (on gmail) I still get them sent to the email that I have set from which is also the one verified at sendgrid. I cannot figure out why the email message does not get sent correctly to the outwards email address.
`
$email = (new TemplatedEmail())
Is there any limitation for sendgrid users of free accounts for sending emails and thus all get sent to the owner email address of the sendgrid?
Should I have paid attention to the following lesson I would then have found out that I had previously programmed the system to send all the mails to my account as had been done here, so please ignore my doubt, and thanks for such a great work.
Hey Juan,
Glad you figured out the problem yourself, well done! And thanks for sharing the exact reason with others, it might be helpful.
Cheers!
In symfony v6+ i am fighting with this problem https://github.com/symfony/...
Mail goes to the queue instead of being sent. By command bin/console messenger:consume i resolved issue with dev enviroment. How set up it that will work for production environment if i am using webhosting on which i deploy my symfony by symfony/apache-pack. Sorry i didn't read or worked with symfony messenger before.
Hey Miky
The easiest thing to do is to just don't route the
SendEmailMessagein your messenger.yaml config file. Or, you can still route it but use thesynctransport instead of the asyncI hope it helps. Cheers!
Hello Guys,
have anyone try to use a transnational template with sendgrid using the smtp api? according to the sendgrid doc you have to send the template id ("template_id": "5997fcf6-2b9f-484d-acd5-7e9a99f0dc1f") on the X-SMTPAPI header but i don't see a way to send that parameter, would you please help??
Thanks
Hey Abel,
Personally, I've never done this before, but I believe you can set additional email headers as:
Just follow their docs to know which value exactly you need to set. Does it work for you?
I hope this helps!
Cheers!
Hi folks !
Is anybody here has some experience with Mandrill API to share with ?
<b>Here is my context:</b>
I already tried to send email, in local with MailCatcher and everything works fine so I can asume my code is correct.
But with Mandrill... I can't see emails in their "outbound".
In my .env.local:
<br />##> symfony/mailchimp-mailer ###<br />MAILER_DSN=mandrill+api://my_key@default<br /><a href="https://symfony.com/doc/current/components/mailer.html#transport">https://symfony.com/doc/current/components/mailer.html#transport</a>
If someone know or see something wrong.. Thanks!
Hey Christina V.!
I don't have direct experience, unfortunately :/. Have you tried the +smtp or +https versions of Mandrill? I think, from Mailer's standpoint, they're slightly more preferred - but, it *shouldn't* matter. Especially if you use the https one, you could add some debugging to this class in case it fails - https://github.com/symfony/... - and you should also see some logging I think.
I hope this helps!
Cheers!
Hey, it's really weird. Since April 6, 2020 we have to authenticate the sender. Thing I did. But when I try to send an email, I always come across this error:
Even when a sender's email address is validated. I tried at least 10 times recreating an API Key, but nothing, I still come across this error
Hello Kiuega and @weaverryan !
Yes, that was what we had to do in the end! Thanks for the update !
Hey Kiuega,
We're sorry about that! Hm, did you verify your email address successfully? You should see "Sender Verified" message on success, see this guide: https://sendgrid.com/docs/u... . 550 error means "mailbox unavailable", from their docs I see the next possible reason behind of it:
Or see more detailed explanation here about how to fix it: https://sendgrid.com/docs/f...
I hope this helps! Let me know if it does not.
Cheers!
Hi victor!
I just tested this by creating a new account. You're both correct that you DO now need to "verify your sender" before sending any emails - I got the exact same error before doing that. We'll add a note to the tutorial.
However, once I did "Single Sender Verification" - https://sendgrid.com/docs/ui/sending-email/sender-verification/ - and then updated the
setFrom()calls in Mailer.php to use the email address i just used, everything worked fine. I did typo my email about 3 times... but once I made it match my "verified" address exactly, it worked just fine.Cheers!
Hi,
I'm looking for docs about how manage email on symfonyCloud via the "SendGrid sub-account" auto provisioned. You know the default adress ?
Cheers
Hey Stephane!
Sorry for the slow reply :). I actually don't know much about this sub-account but I *think* that the idea is this: when you're getting started, using the sub-account is great because it's fast and easy. But as soon as you're going to production, you should create your own SendGrid account. That will allow you to do proper things like SPF setup on your domain so that the emails are deliverable.
Cheers!
Hey weaverryan
Thank for your answer. Finally I understand that there is no url for manage email on SymfonyCloud. But I succeeded to send email via messenger and notifier.
Best.
"Houston: no signs of life"
Start the conversation!