Posts Learn Components new Snippets new Categories Tags About

Default Email Subject in Laravel Notifications

Learn to name your Laravel notification class property to get a proper email subject as the default value

Created on Jul 01, 2021


When creating Laravel Notification and you don't specify a subject to the "toMail" method, the default class name will be used as the default email subject. So the CamelCased name of your class will be read by Laravel and it will become the email subject by default.

So if your notification class is like below:
class UserConfirmationEmail extends Notification
  // your code here

Then the email notification that the user will receive will have the subject of "User Confirmation Email".

If you like our tutorial, do make sure to support us with some coffee. We need the juice to write the content during the night 🤙🏻