Mail notification templates - custom line()

Posted 6 months ago by lambooni

I am using notifications to send mails as follows:

      return (new MailMessage)
            ->greeting('Hello ' . $notifiable->first_name . ',' )
            ->subject('Reset Password Notification')
            ->line('You are receiving this email because we received a password reset request for your account.')
            ->action('Reset Password',
                url(config('app.url').route('password.reset', $this->token, false))
            )
            ->line('If you did not request a password reset, please just ignore this message')
            ->salutation(config('mail.salutation'));

This all works great, using the standard template.

I have now published the vendor files and have started to edit the template and CSS. To get my theme to work, when I create a new line, I need it to be wrapped by some HTML code.

i.e. ->line('This is my new line') needs to to render as (simplified):

<table>
<tr>
<td>
This is my new line
</td>
</tr>
</table>

For more complex emails I am creating them from scratch with the templates, but I really love notifications for these simple messages and hope there is a way to do this?

Please sign in or create an account to participate in this conversation.