Skip to content

Entrydo/sendgrid-send-mail-consumer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Sendgrid Transactional Mails Consumer

Purpose

Build tiny microservice, that will consume messages from RabbitMQ queue and send emails via SendGrid API.

Install

  1. Create .env file (use .env.example as template)
  2. Install composer using composer install

Run

  • Run the script via php src/script.php

How it works

The script connects to RabbitMQ queue and consumes messages. Consumer expects messages to be in JSON format.

{
  "from": {
    "name": "John Doe",
    "mail": "john@doe.com" 
  },
  "to": {
    "name": "John Doe",
    "mail": "john@doe.com" 
  },
  "template_id": "7011212b-09f7-4806-8b3a-79bc16682674"
}

TODO

  • Catch parse errors when message is invalid json
  • Dynamic queue name via parameter
  • Support for messages without template (adds subject and content properties to message's json)
  • Dockerfile
  • Tests??
  • CI?
  • PHPSTAN?
  • Coding standard?

About

Consumer for RabbitMQ that sends emails via Sendgrid

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages