{"id":23003700,"url":"https://github.com/stechstudio/laravel-email-events","last_synced_at":"2025-08-14T01:32:10.327Z","repository":{"id":57059369,"uuid":"229977649","full_name":"stechstudio/laravel-email-events","owner":"stechstudio","description":"Laravel package to normalize webhooks from email providers like SendGrid or Postmark","archived":false,"fork":false,"pushed_at":"2024-03-29T21:56:48.000Z","size":26,"stargazers_count":1,"open_issues_count":0,"forks_count":1,"subscribers_count":6,"default_branch":"master","last_synced_at":"2024-10-02T18:17:40.290Z","etag":null,"topics":["email","laravel","postmark","sendgrid","webhooks"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/stechstudio.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null}},"created_at":"2019-12-24T17:07:55.000Z","updated_at":"2024-03-18T00:39:43.000Z","dependencies_parsed_at":"2024-03-29T22:48:25.029Z","dependency_job_id":null,"html_url":"https://github.com/stechstudio/laravel-email-events","commit_stats":{"total_commits":10,"total_committers":1,"mean_commits":10.0,"dds":0.0,"last_synced_commit":"0a359aeb3f04ad86faf1c9aa2c68d08359270dab"},"previous_names":[],"tags_count":9,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stechstudio%2Flaravel-email-events","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stechstudio%2Flaravel-email-events/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stechstudio%2Flaravel-email-events/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stechstudio%2Flaravel-email-events/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/stechstudio","download_url":"https://codeload.github.com/stechstudio/laravel-email-events/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":229683938,"owners_count":18107128,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["email","laravel","postmark","sendgrid","webhooks"],"created_at":"2024-12-15T07:15:03.599Z","updated_at":"2024-12-15T07:15:04.044Z","avatar_url":"https://github.com/stechstudio.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Email event webhook processing\n\n[![Latest Version on Packagist](https://img.shields.io/packagist/v/stechstudio/laravel-email-events.svg?style=flat-square)](https://packagist.org/packages/stechstudio/laravel-email-events)\n[![Software License](https://img.shields.io/badge/license-MIT-brightgreen.svg?style=flat-square)](LICENSE.md)\n\nSo you have your Laravel app sending email out through SendGrid or Mailgun or Postmark, super. Now you want to capture webhooks and react to email events, such as deliveries or bounces. This is where it can get a bit messy, authorizing the webhook submission, parsing the payload, handling the details... and then of course you've tied yourself to one particular email provider.\n\nThis package greatly simplifies the process. It will accept webhook submissions from any supported email provider, authorize the submission, generalize it to a standard data format, and fire off a Laravel event. Now all you have to do is listen for an event and go!\n\n## Installation\n\nVia Composer\n\n``` bash\n$ composer require stechstudio/laravel-email-events\n```\n\n## Quick start\n\n### 1. Add the routes\n\nIn your `routes/web.php` file add:\n\n```php\nEmailEvents::routes();\n```\n\nThis will wire up a route at `.hooks/email-events/{provider}`. \n\n### 2. Configure your auth method\n\nThere are multiple authorization options available. The default option (and works with any provider) is just a URL token.\n\nIn your app .env file set a token secret:\n\n```\nMAIL_EVENTS_AUTH_TOKEN=mysecrettoken\n```\n\n### 3. Configure your mail provider with your webhook endpoint\n\nLog in to your email provider account, find the webhook section, and add your URL endpoint. Make sure to specify the provider name, and include the auth token.\n\nFor example, if you are using SendGrid you would go to the [Mail Settings](https://app.sendgrid.com/settings/mail_settings) page, turn on the \"Event Notification\" setting, check all the actions that you care about, and provide your POST URL:\n\n```\nhttps://\u003cyourdomain\u003e/.hooks/email-events/sendgrid?auth=mysecrettoken\n```\n\n\u003e Note while in local/development mode you can use [`valet share`](https://laravel.com/docs/master/valet#sharing-sites) to get a publicly accessible domain for your app.\n\n### 4. Listen for the event\n\nLastly, you need to listen for an email event in your app. Setup an [event listener](https://laravel.com/docs/master/events#defining-listeners) and listen for `STS\\EmailEvents\\EmailEvent`.\n\nSomething like this:\n\n```php\nnamespace App\\Listeners;\n\nuse STS\\EmailEvents\\EmailEvent;\n\nclass NotifyBouncedEmail {\n\n    public function handle(EmailEvent $event)\n    {\n        // I only care about bounces\n        if($event-\u003egetAction() != EmailEvent::EVENT_BOUNCED) {\n            return;\n        } \n        \n        // Ok so we have an email bounce! Need to go handle that. Maybe notify us on Slack?\n        // ...\n    }\n    \n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstechstudio%2Flaravel-email-events","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fstechstudio%2Flaravel-email-events","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstechstudio%2Flaravel-email-events/lists"}