Posts Learn Components Snippets Categories Tags Tools 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 by being our Patreon or buy us some coffee ☕️

Load comments for Default Email Subject in Laravel Notifications