Weave Code
Code Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Sendgrid Mailer Laravel Package

symfony/sendgrid-mailer

Symfony mailer transport for SendGrid. Send emails via SendGrid API using Symfony Mailer, with support for templates, attachments, and robust delivery options. Ideal for integrating SendGrid into Symfony apps with a familiar mailer interface.

View on GitHub
Deep Wiki
Context7

Sendgrid Bridge

Provides Sendgrid integration for Symfony Mailer.

Configuration example:

# SMTP
MAILER_DSN=sendgrid+smtp://KEY@default?region=REGION

# API
MAILER_DSN=sendgrid+api://KEY@default?region=REGION

where:

  • KEY is your Sendgrid API Key
  • REGION is Sendgrid selected region (default to global)

Webhook

Create a route:

framework:
    webhook:
        routing:
            sendgrid:
                service: mailer.webhook.request_parser.sendgrid
                secret: '!SENDGRID_VALIDATION_SECRET!' # Leave blank if you don't want to use the signature validation

And a consume:

#[\Symfony\Component\RemoteEvent\Attribute\AsRemoteEventConsumer(name: 'sendgrid')]
class SendGridConsumer implements ConsumerInterface
{
    public function consume(RemoteEvent|MailerDeliveryEvent $event): void
    {
        // your code
    }
}

Suppression Groups

Create an e-mail and add the SuppressionGroupHeader:

use Symfony\Component\Mailer\Bridge\Sendgrid\Header\SuppressionGroupHeader;
// [...]
$email = new Email();
$email->getHeaders()->add(new SuppressionGroupHeader(GROUP_ID, GROUPS_TO_DISPLAY));

where:

  • GROUP_ID is your Sendgrid suppression group ID
  • GROUPS_TO_DISPLAY_ID is an array of the Sendgrid suppression group IDs presented to the user

Scheduling

When using the API transport (with a sendgrid+api DSN), you can schedule your emails by providing a \DateTimeInterface object in a Symfony\Component\Mime\Header\DateHeader named Send-At.

$email = new \Symfony\Component\Mime\Email();
$email->getHeaders()->addDateHeader('Send-At', new \DateTimeImmutable('+3 hours'));

It will be mapped to the send_at parameter of the [POST] /mail/send API endpoint

Sponsor

This package is looking for a backer.

Help Symfony by sponsoring its development!

Resources

Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
hamzi/corewatch
minionfactory/raw-hydrator
hexters/coinpayment
rjcodes/rjcms
act-training/laravel-permissions-manager
alimarchal/laravel-chart-of-accounts
babenkoivan/elastic-scout-driver
mkwebdesign/filament-watchdog-v5
renatomarinho/laravel-page-speed
zedmagdy/filament-business-hours
renatovdemoura/blade-elements-ui
devgeek/beacon-admin
benjamin-rqt/data-watcher-bundle
atriumphp/atrium
sandermuller/package-boost-laravel
sandermuller/boost-skills
redaxo/core
yusufgenc/filament-api-forge
l3aro/rating-star-for-filament
leek/filament-subtenant-scope