Thursday, February 10, 2022

[FIXED] Set SendGrid category in Laravel's mail library

Issue

I'm sending an email in Laravel via SendGrid using the configuration suggested in SendGrid's docs.

Just to provide an example of how it looks now:

Mail::send('emails.demo', $data, function($message)
{
    $message->to('jane@example.com', 'Jane Doe')->subject('This is a demo!');
});

The email itself works fine, but I'd like to add a SendGrid category. I've accomplished this in past non-Laravel projects using the addCategory() method in this repo.

My question: Is there an easy way to add a SendGrid category just using the Laravel mail library, or does it make more sense to just use the SendGrid PHP library?


Solution

I would just use the library, even though it isn't that pretty.



Answered By - Daniel Payne

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.