Sign inSign up

ecmchow/smtp-mailer

By ecmchow

Updated about 4 years ago

SMTP mail sending and scheduling service

Image
0

1.2K

ecmchow/smtp-mailer repository overview

SMTP Mailer

Introduction

SMTP Mailer is a SMTP mail sending and scheduling service powered by Workerman and PHPMailer.

It is designed to be a one-stop and portable microservice for managing SMTP mailing operations across multiple applications/services. While it runs on PHP CLI, it can be integrated with any backend stack that supports internal JSON/TCP communication. It also includes a basic API for managing a file-based email queue and template without database dependency.

Running multiple apps with shared SMTP accounts and/or email templates? Want to send an HTML email from a Bash script? Just setup a default SMTP credentials and you can start sending email with a simple JSON/TCP request.

Quickstart with Docker

Copy the example Docker compose file:

Before starting the service, make sure you have a setup directories for the queued mail/mail HTML template (ignore if you using Redis data store) and setup a valid SMTP credentials in the service env file. To avoid confusing the default env file for docker compose and the SMTP Mailer service, copy/rename the .env.example to .env.service and change the listening address to 0.0.0.0:

MAILER_ADDR = "0.0.0.0"
...
REDIS_ADDR = "0.0.0.0" ; if you are using Redis

Pass the service env file and directories through the Docker volumes

  smtp_mailer:
  ...
    volumes:
      - /path/to/your/.env.service:/var/www/smtp-mailer/.env # service env file
      - /path/to/html:/var/www/smtp-mailer/Template/html # HTML Template directory
      - /path/to/queue-mail:/var/www/smtp-mailer/Queue/mail # Queued mail directory
      - /path/to/processing-mail:/var/www/smtp-mailer/Queue/temp # Processing mail directory

Run docker compose up -d to start the SMTP Mailer service. The service will be available at tcp://localhost:3000/ by default.

To test the SMTP Mailer service, simple run echo '{"sendMail":{"to":["[email protected]"],"ccList":[],"bccList":[],"attachments":[],"embedded":[],"subject":"Test Email","body":"Test Email Body","fromName":"Test System"}}' | nc localhost 3000, you should see the following response:

{"status":"success","data":null,"message":"mail sent successfully"}

For detailed service env configuration, please visit the env documentation. You can view all available request and required schema in the API documentation.

Tag summary

Content type

Image

Digest

sha256:3aae1b292

Size

35.2 MB

Last updated

about 4 years ago

docker pull ecmchow/smtp-mailer