Edit the announcement email template

Vanguard - Advanced PHP Login and User Management Vanguard - Advanced PHP Login and User Management May 25, 2020
Login to reply
Milos Stojanovic Support Agent
3 years ago

Hey Alex,

If you want to change the style of the emails then you'll need to edit the files in "resources/views/vendor/mail/html" directory or the stylesheet which is located in resources/views/vendor/mail/html/themes/default.css file.

For the format of the announcement email that is being sent, you can do it by editing the following file: vendor/vanguardapp/announcements/resources/views/mail/notification.blade.php

However, since announcements is basically a plugin (which means it is a Laravel package) if you run "composer update" it can overwrite the changes you did by editing the files from the "/vendor" directory. So, the recommended way to customize the package blade files in Laravel is by creating your own version of it and by storing it within the "/resources/views/vendor" directory. In your case you will need to do the following:

1. Create the folder named announcements inside the /resources/views/vendor directory.

2. Copy the whole "mail" directory from "vendor/vanguardapp/announcements/resources/views/" folder to your newly created announcements folder.

3. Customize the /resources/views/vendor/announcements/mail/notification.blade.php file. to fit your needs.

To learn more about this approach, I will recommend you to check the "Overriding Package Views" section in official Laravel documentation: https://laravel.com/docs/7.x/packages#views

Kind regards,

Alex Buelau
3 years ago

Hey there, I just want to change the style/format of the email sent when I create announcements. I have tried to edit /vanguard/resources/views/vendor/notification/email.blade.php but any changes I make there don't affect the style of emails sent in announcement. So which file do I need to edit to change the announcement email template.