laravel-shortcodes icon indicating copy to clipboard operation
laravel-shortcodes copied to clipboard

Shortocodes on email

Open xavicabot opened this issue 5 years ago • 1 comments

Hi

First of all great package.

I can use it for views, but if i use it for mailing, it takes an error:

Code

return $this->from('[email protected]', 'Sender Name')
            ->subject($this->newsletter->subject)
            ->view($this->newsletter->template->view)->withShortcodes();

Error ErrorException Undefined offset: 0

Anyone knows what can i do?

Thanks

xavicabot avatar Feb 06 '20 01:02 xavicabot

Sorry for delay.

Thank you for your appreciation, sir.

I think Mail class (view) method is different. But maybe you can render a view into variable and pass it to Mail View method.

$view = view($this->newsletter->template->view)->withShortcodes()->render();
// $view = view($this->newsletter->template->view)->render()->withShortcodes();

return $this->from('[email protected]', 'Sender Name')
            ->subject($this->newsletter->subject)
            ->view($view);```

I am not sure, but something like that could work.

Thanks,

webwizo avatar Feb 21 '20 10:02 webwizo