How to Send Email in PHP - Symfony Mailer - Email Protocols - Mailhog Setup - Full PHP 8 Tutorial

  Рет қаралды 25,647

Program With Gio

Program With Gio

Күн бұрын

Пікірлер: 71
@cpanagoulias
@cpanagoulias 2 жыл бұрын
Came here due to KZbin's algorithm, stayed for the content. Even for stuff I thought I had a good grasp on, there are always valuable gems inside every video that make me go "What? You can do this?"! I can't thank you enough for the good work and awesome way of presenting the material. Keep up the excellent work Gio! Please don't stop. We need more! Thanks again!
@ProgramWithGio
@ProgramWithGio 2 жыл бұрын
That's awesome, thank you so much 🙏 💙
@hansschuijff
@hansschuijff 2 жыл бұрын
Great lesson again. I like that you teach as much about the php language, as oop design concepts and how to setup a working dev environment and use populair packages. A great start for anyone that wants to step into modern code practices. Thanks, Gio. Learning a lot from you.
@ProgramWithGio
@ProgramWithGio 2 жыл бұрын
Happy to hear Hans, thank you 🙌
@hannanmiah1240
@hannanmiah1240 2 жыл бұрын
best php tutorial I've seen ever.
@ProgramWithGio
@ProgramWithGio 2 жыл бұрын
Thank you 🙌
@constantinci
@constantinci 2 жыл бұрын
Great as usually. You simply read my mind (mailhog) 😃.
@ProgramWithGio
@ProgramWithGio 2 жыл бұрын
Thank you. Glad it was useful 🙌
@Zubbee
@Zubbee 2 жыл бұрын
Wow. This is all new to me. I followed and practiced as well. It's great to see how some of these things work. Thanks Gio. I'm fired up to move on.
@ProgramWithGio
@ProgramWithGio 2 жыл бұрын
Great to hear 💙
@edwardai209
@edwardai209 2 жыл бұрын
Clear and solid explanation for Emailer Package
@ProgramWithGio
@ProgramWithGio 2 жыл бұрын
Glad you like it 🙌. Thank you
@martin2126
@martin2126 2 жыл бұрын
Amazing tutorial. Very detailed and knowledgeable. Thank you very much!
@ProgramWithGio
@ProgramWithGio 2 жыл бұрын
Happy to hear that, thank you 🙌
@sergeykonov4562
@sergeykonov4562 11 ай бұрын
Great as usually.
@ProgramWithGio
@ProgramWithGio 10 ай бұрын
Thank you
@abdallakaram5376
@abdallakaram5376 2 жыл бұрын
Great Gio Back welcome back master
@stephen.cabreros
@stephen.cabreros Жыл бұрын
w0w we simply swap mailer to our custom mailer as an example of implementing an interface or implementation, splendid
@ProgramWithGio
@ProgramWithGio Жыл бұрын
Glad you like it, thank you
@aleksandrkanygin2672
@aleksandrkanygin2672 2 жыл бұрын
Awesome, watching your course i improved not only my php skills specifically, but coding overall. I see a lot of improvements in my JS code after watching your course to this point. Thank you 👍👍👍
@ProgramWithGio
@ProgramWithGio 2 жыл бұрын
That's so awesome, thank you 💙💙
@Jam-ht2ky
@Jam-ht2ky Жыл бұрын
totally agree. The firm i work in used to be PHP mainly but they switched to JavaScript because of performance reasons but they brought a lot of practises of PHP to javascript and studying this series helped me become better with both
@hsemix
@hsemix 2 жыл бұрын
Thanks for the good content
@ProgramWithGio
@ProgramWithGio 2 жыл бұрын
You're welcome
@truthteachers
@truthteachers Жыл бұрын
Bro, I need help really bad. (1) You installed MailHog using docker and some of us are not using docker (2) at timestamp 8:35, your video is not showing the use classes and when tried to import the class, my script imports classes which i assume to be correct (3) The is view for "users/register" which is not mentioned in the video. To resolve (1) I setup my email account in my own shared vps host but do not where to include the user password.
@ProgramWithGio
@ProgramWithGio Жыл бұрын
The source is in the repo, link in description. So you can compare the use statements, not everything can be visible in the videos at all times. The view file is just a simple HTML also part of the source. As for mailhog it can be installed on windows without Docker as well. You can do a bit of googling to find instructions how to set it up without Docker. There is executable file you can download github.com/mailhog/MailHog/releases You don't have to use mailhog, you can also just create mailtrap account for example or use any other SMTP service/account, just configure the credentials properly. You can check the Symfony mailer docs for exact options. Watch from 6:15 I explain DSN so you'll just have to replace it with your credentials, username, password, host, port.
@truthteachers
@truthteachers Жыл бұрын
@@ProgramWithGio The repo is end product for the video. The use statements do not seem to match those that are imported as we progress. I decided to drop mailhog which seems to be way outdated (2020) for Windows. I will use my vps email server. I am also testing with PHPMailer which simpler to use then symfony/mailer (very complicated).
@truthteachers
@truthteachers Жыл бұрын
@@ProgramWithGio Just an update. I tested using the symfony and phpmailer libraries. Both worked fine with my vps email server. Thank you.
@khancross
@khancross 2 жыл бұрын
Yeah ok but how to implement this mailer to a HTML website? You start here 2:46 with a PHP document. Where is this from and what to do with this PHP document?
@ProgramWithGio
@ProgramWithGio 2 жыл бұрын
There is a link to the source repo in the description. HTML part is done off the recording, it's just a form with post request to the register route, nothing fancy.
@khancross
@khancross 2 жыл бұрын
@@ProgramWithGio Is it enough to upload this PHP form and make ?
@memack101
@memack101 2 жыл бұрын
Thank you.
@ProgramWithGio
@ProgramWithGio 2 жыл бұрын
💙
@devanii
@devanii 2 жыл бұрын
Very nice! Do you leave the dsn in production empty? Or to null
@ProgramWithGio
@ProgramWithGio 2 жыл бұрын
Thank you. No in production that would be filled in.
@devanii
@devanii 2 жыл бұрын
@@ProgramWithGio ah but with the user and pass filled in
@ProgramWithGio
@ProgramWithGio 2 жыл бұрын
@@devanii yup
@topalek
@topalek Жыл бұрын
Do you plan to more laravel courses?
@ProgramWithGio
@ProgramWithGio Жыл бұрын
Yes after we finish the PHP series
@expresscoding3525
@expresscoding3525 Жыл бұрын
Hello sir, I've a question, you removed this line of code: $mailer = new Mailer($transport); from UserController while refactoring at near the end of the lesson, but it still works, how is that possible, please explain it sir.
@expresscoding3525
@expresscoding3525 Жыл бұрын
at 12:54 when you started refactoring ?
@ProgramWithGio
@ProgramWithGio Жыл бұрын
We are injecting that as a dependency in the constructor, keep watching & you will see that we add the custom mailer class & bind it in the container
@liym-ntairaylangdji3441
@liym-ntairaylangdji3441 10 ай бұрын
Hello sir, please what about sending emails with Google? How does it work?
@ProgramWithGio
@ProgramWithGio 9 ай бұрын
Not sure what you mean
@liym-ntairaylangdji3441
@liym-ntairaylangdji3441 9 ай бұрын
@@ProgramWithGio what I actually meant was how I could send emails using gmail smtp beacause I tried with mailhog but I got this error "Uncaught Symfony\Component\Mailer\Exception\TransportException: Connection could not be established with host "mailhog:1025": stream_socket_client(): php_network_getaddresses: getaddrinfo for mailhog failed: Temporary failure in name resolution in /var/www/html/vendor/symfony/mailer/Transport/Smtp/Stream/SocketStream.php:154"
@DigitaSkills101
@DigitaSkills101 2 жыл бұрын
I am a little lost how can we access the config variable without using this keyword and since when is this function is available
@ProgramWithGio
@ProgramWithGio 2 жыл бұрын
Hey, are you referring to the Config class or the $_ENV super global? We covered both of them in the series. If you are referring to accessing array properties on Config class that's done via magic getter method (also covered in the series). Please include the timestamp for the part that's confusing and I'll be happy to clarify it further 👍
@DigitaSkills101
@DigitaSkills101 2 жыл бұрын
@@ProgramWithGio Sorry for the trouble but the problem is solved , I didn't know that we could access class properties without the "$this" keyword in the magic __construct function. Your tutorial helped me know that. Thanks 👍
@ProgramWithGio
@ProgramWithGio 2 жыл бұрын
@@DigitaSkills101 awesome, no problem at all. Thanks 🙏
@mateuszb4387
@mateuszb4387 2 жыл бұрын
Modern PHP Bible
@ProgramWithGio
@ProgramWithGio 2 жыл бұрын
Thank you 🙌
@nooralmoswy7347
@nooralmoswy7347 2 жыл бұрын
composer : The term 'composer' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again. that is what happen when trying composer composer require symfony/mailer 😟😟
@ProgramWithGio
@ProgramWithGio 2 жыл бұрын
My assumption is that you are trying to run composer commands in PowerShell where it's not available. Launch the Linux OS terminal if you are using WSL2 on Windows. Also try googling that error.
@ნოდარდავითულიანი
@ნოდარდავითულიანი 2 жыл бұрын
ძაან გთხოვ, შეგიძლია გააკეთო ეს ვიდეო contact form -ით? ანუ კლიენტი წერს თავის იმეილს სახელს ტექსტს და ეს მისდის საიტის მფლობელს მეილზე
@ProgramWithGio
@ProgramWithGio 2 жыл бұрын
ვეცდები, მადლობა რჩევისთვის.
@ნოდარდავითულიანი
@ნოდარდავითულიანი 2 жыл бұрын
@@ProgramWithGio არაფრის. ძალიან დამეხმარებოდა ეგ ვიდეო
@ნოდარდავითულიანი
@ნოდარდავითულიანი 2 жыл бұрын
ხომ არ მოგიფიქრებია ჩაწერა? დდ
@ProgramWithGio
@ProgramWithGio 2 жыл бұрын
@@ნოდარდავითულიანი არა. ალბათ კურსის ბოლოსკენ თუ გამოვნახე თავისუფალი დრო. ეხლა დრო არ მაქვს და ბევრი სხვა ვიდეო მაქვს ჩასაწერი.
@belloabdulroufolatunbosun5439
@belloabdulroufolatunbosun5439 2 жыл бұрын
Phpmailer vs symfony mailer
@ProgramWithGio
@ProgramWithGio 2 жыл бұрын
I haven't used Phpmailer so wouldn't be able to give you a good answer to that but I'm sure it's a good alternative as well
@lairotuT-Tutorial
@lairotuT-Tutorial Ай бұрын
This lesson will keep me busy for a while :-) Great great stuff Gio! First of possibly many questions: in the Symfony package @ Symfony\Component\Mime\Message.php I can see inside the constructor: $this->headers = $headers ? clone $headers : new Headers(); You mentioned cloning in some lessons before but I am not really understanding why in case of an Email we should clone this object instead of just passing it through? $this->headers = $headers ? $headers : new Headers(); At least I would (if really needed, clone the headers object one layer above and in addition would get rid of the nullable Headers... that makes no sense imo as we create the object if it is not existing ergo: We will obviously always need it. public function __construct( private Headers $headers, private ?AbstractPart $body = null, ) {} Would you agree?
@ProgramWithGio
@ProgramWithGio Ай бұрын
I'm sure Symfony developers had a reason for it. Cloning means that changes to the properties of the headers variable wont have effect on the object outside of the Message class. So if you had headers object outside of Message class & you passed it down and the Message did not clone it, when Message class makes changes to properties of the Headers object, it would affect the outer scope as well & that may not always be desired. So cloning it ensures that modifications to headers object only affects the Message class & nothing else outside of it
@lairotuT-Tutorial
@lairotuT-Tutorial Ай бұрын
@@ProgramWithGio Well, I kept the cloning but as mentioned moved it upwards and got rid of the nullable to force error in case it should ever be null. Thanks again for your incredible high effort in answering each and every post! You are just the GOAT!
@AlexDolon
@AlexDolon 10 ай бұрын
Hey Gio, I try to send emails using mailhog but I get this error "Uncaught Symfony\Component\Mailer\Exception\TransportException: Connection could not be established with host "mailhog:1025": stream_socket_client(): php_network_getaddresses: getaddrinfo for mailhog failed: Temporary failure in name resolution in /var/www/html/vendor/symfony/mailer/Transport/Smtp/Stream/SocketStream.php:154". Please what could be the solution?
@ProgramWithGio
@ProgramWithGio 9 ай бұрын
make sure mailhog container is running
PHP cURL API Tutorial - Emailable API Integration - Full PHP 8 Tutorial
17:56
Une nouvelle voiture pour Noël 🥹
00:28
Nicocapone
Рет қаралды 4,3 МЛН
REAL or FAKE? #beatbox #tiktok
01:03
BeatboxJCOP
Рет қаралды 16 МЛН
Enceinte et en Bazard: Les Chroniques du Nettoyage ! 🚽✨
00:21
Two More French
Рет қаралды 42 МЛН
My scorpion was taken away from me 😢
00:55
TyphoonFast 5
Рет қаралды 1,6 МЛН
Send email with PHP | Create a Working Contact Form Using PHP
10:18
Dave Hollingworth
Рет қаралды 151 М.
How to Send Emails in Symfony - Tutorial by Mailtrap
5:54
Mailtrap
Рет қаралды 5 М.
When to use Traits, Interfaces, and Abstract Classes in PHP
15:08
Andrew Schmelyun
Рет қаралды 24 М.
PHP Enums With Practical Examples - Full PHP 8 Tutorial
28:13
Program With Gio
Рет қаралды 27 М.
OAuth 2.0 and OpenID Connect (in plain English)
1:02:17
OktaDev
Рет қаралды 1,8 МЛН
Making Tmux Better AND Beautiful -- here’s how
10:56
typecraft
Рет қаралды 102 М.
Data Transfer Objects - What Are DTOs - Full PHP 8 Tutorial
13:03
Program With Gio
Рет қаралды 43 М.
Une nouvelle voiture pour Noël 🥹
00:28
Nicocapone
Рет қаралды 4,3 МЛН