Hello there! Before we start, this article is a continuation from the previous article here. If you haven’t seen that article, don’t worry that’s very ok and you can refer to this source code of the previous article. For the recap, in the previous article, we created an email verification system when a new user registers to our app using laravel/ui packages and ui vue scaffolding. In this article, we’ll create a custom Email HTTP, Markdown, and Notification so that you can have a fully customizable email content. Ok, let’s start.
- HTTP vs Markdown vs Notification
- Configuring the Mails
- Configuring the Mail HTTP
- Configuring the Mail Markdown
- Configuring the Notification
HTTP vs Markdown vs Notification
In Laravel, you can create 3 types of mails, and those are HTTP, markdown, and notification. There is a raw type email too, but I don’t think this raw type email is applicable in real-life projects.
HTTP Email is, like literally the name, an email where the content is in the HTTP syntax, and you can embed your own CSS/bootstrap/image/etc inside it. You can easily modify the content inside your HTTP syntax, and of course, you can create a button or call-to-action too. We can use php artisan to make an HTTP email.
php artisan make:mail CustomHttpEmail
What is the meaning markdown mail? Well, of course, it is a mail but, the content inside it is not HTML syntax. The good news when using this markdown is, you can type the components that you want, for example, a heading, list, or button and your view will automatically become beautiful. It is because when we are using the markdown, Laravel will automatically generate CSS to make our markdown mail beautiful. It’s super useful and saves time for us to focus on the logic, not the beauty of the mail. We can create the markdown mail with this command:
php artisan make:mail CustomMarkdownEmail --markdown=emails.custom-markdown
Last thing, what is notification? Yeah, it’s a type of mails too really. It’s kind of tricky when choosing whether we…