Dockerized email microservice template using Lumen
This is a microservice dockerized template for sending bulk emails using Lumen 8.x. Laravel Queue is used to schedule for sending emails.
Email templates are fully dynamic content, it supports full HTML content.
Email data
4 key elements are:
- Entity: Entity will help us to know what the notification is about. For eg, a notification can be about a project or a user etc.
- Entity objects: Entity object are the different types of notifications. For eg, User is a entity and it supported 3 kinds of objects like new user welcome, invitation user, invitation accepted.
- Actor: The actor is the user who is responsible for triggering a notification. If the value is null then it is from company's no-reply email.
- Notifier: Notifier is the user to whom the notification has to be sent.
Database ER
Testing Email Configuration
I am using mailtrap, it is a email sandbox service. Official tutorial can be found here to integrate with Larave/Lumen.
Used technologies
Installation
Use the package manager git to install the repo.
git clone https://github.com/jaygaha/notification-microservice.git
cd notification-microservice
docker compose up -d --build
Database migration and seeding
docker compose exec mail-web sh
/var/www/html# php artisan migrate:fresh --seed
If you don't want to use faker data then please omit --seed
Run Job
Manualy run the schedule
php artisan schedule:run
Create a cron job in the server which run every minute.
* * * * * cd /path-to-your-project && php artisan schedule:run >> /dev/null 2>&1
TODO
- API Route (CRUD)
Contributing
All code submissions will only be evaluated and accepted as pull-requests. If you have any questions or find any bugs please feel free to open an issue.
License
Feel free to use.