symfony/sendgrid-mailer

Symfony Sendgrid Mailer Bridge

Installs: 6 934 316

Dependents: 13

Suggesters: 6

Security: 0

Stars: 63

Watchers: 5

Forks: 12

Type:symfony-mailer-bridge

v7.2.1 2024-12-07 09:03 UTC

This package is auto-updated.

Last update: 2024-12-11 12:14:01 UTC


README

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 dont 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
    }
}

Resources