I'm working on a project which is built using Laravel and we have different events when we need to send an email. Until now we used SMTP but due to our company security policy we need to create a micro-service which will take care of sending emails.
My project will make a request with the email template and the email service will send it.
To send an email I'm using Laravel's "mailable" objects and the templates can contain HTMLL & CSS.
The plan is to use "guzzlehttp/guzzle" library for the requests. But my problem is that I don't know how to send my template content in order to keep the styling.
What I found until now is that I can render a template:
$string = (new GroupEnrollment($group, $user))->render();
But this returns me as string which is rendered like in the picture bellow:
What I also found is that now you can render the "mailable" directly in the browser for a preview:
return new GroupEnrollment($group, $user);
This is rendered how I need it, but this is the mailable object and I don't see the template in his properties.
From what I see that are services like MailGun that are API based so there should be a way to get the correct format. Any idea how can I do this?
from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/2mGbRc9
via IFTTT
Aucun commentaire:
Enregistrer un commentaire