Show HN: A mailer server to help you send emails


A mailer server to be used alongside with your hold SMTP server. You set up the app, configure it alongside with your SMTP server and might well consume the API (and other feautures) to ship emails.

Some parts

  • A chubby REST API for sending emails
  • Supports attachments to emails
  • Supports electronic mail templates and distribution checklist to ship emails to many folks
  • Historical previous of sent emails
  • Integration with Django through


One no longer contemporary want of your functions is to ship transactional electronic mail to their users. In expose for you to make consume of your hold SMTP server (as a change of a
mail sending service) it is most likely you’ll well soon discover that sending electronic mail through SMTP would possibly maybe take care of some time (even seconds
depending for your SMTP server) and that you just would be in a position to seemingly want to assemble it asynchronous after a transient time. The challenge is that configuring the
asynchrnous infrastracture needed (celery or rq or no topic) supreme for this model of job is no longer value it. You mustn’t want to set up all
these dependencies and shifting parts supreme in order to ship a pair of emails. This challenge can hold to peaceful enable you to with
this. You set up this in a server and then consume the API to call it whenever you occur to ship the e-mail. The API is asynchronous and will solution very
quick (some ms) so you the users would possibly maybe no longer skills any extra prolong.

There are a amount of other goodies like seeing the emails which had been ship, taking into legend electronic mail templates and distribution lists (for
users to scheme their hold lists and ship electronic mail to those folks) and even a django electronic mail backend ( which that you just would be in a position to most likely configure django with in expose to make consume of the mailer server for all emails.

You mustn’t consume ths challenge whenever you exercise one thing like mailgun or sendgrid or one other similar electronic mail supplier but whenever you peaceful ship
emails through your SMTP server it is most likely you’ll well obtain this challenge worthwhile. We’re the consume of it in our group for plenty of years as a
centralized electronic mail sending service and it is damaged-down by extra than 10 completely different functions. Also, whenever that you just would be in a position to most likely hold a single app then
you furthermore mght originate no longer want this; supreme configure django-rq for this pronounce app! This challenge is helpful whenever that you just would be in a position to most likely be an group
which hold (or going to hold) a handful of completely different apps that can want to ship transactional electronic mail.


  • python 3.x
  • virtualenv
  • redis
  • postgresql (recommeneded – that you just would be in a position to most likely consume mysql of sqlite whenever you know the implications)
  • supervisord (prompt – that you just would be in a position to most likely consume no topic scheme you wish flee your workers)
  • gunicorn (prompt – that you just would be in a position to most likely consume any wsgi server you will need, i.e uwsgi, apache mod_wsgi and loads others)
  • nginx (prompt – that you just would be in a position to most likely consume any web server you will need)

Configuring redis

In expose for you to make consume of my configuration (from and loads others)

  1. mkdir /home/serafeim/mailer_server/redis/
  2. consume offered and loads others/redis.conf for redis configuration
  3. In expose for you to make consume of supervisord, that you just would be in a position to most likely consume offered and loads others/mailer-server-redis-supervisord.conf

Steps to deploy

  1. Produce a database named mailer_server
  2. Produce a guardian folder for storing app – I damaged-down /home/serafeim/mailer_server
  3. cd /home/serafeim/mailer_server
  4. git clone
  5. python3 -m venv venv
  6. mkdir static
  7. cd /home/serafeim/mailer_server/mailer_server
  8. pip set up -r necessities/prod.txt
  9. cp mailer_server/settings/ mailer_server/settings/
  10. Edit and configure your settings
  11. echo export >> /home/serafeim/mailer_server/venv/bin/spark off
  12. supply ../venv/bin/spark off
  13. python createsuperuser
  14. “cp /home/serafeim/mailer_server/mailer_server/and loads others/mlrsrv.ini /home/serafeim/mailer_server/mlrsrv.ini
  15. sh ./

This can flee the app through uwsgi as a daemon, listening on unix socket /tmp/mlrsrv.ini (which is able to be modified real now from
the mlrsrv.ini uwsgi configuration file).
Log is at /home/serafeim/mailer_server/uwsgi_mlrsrv.log, pid file at /home/serafeim/mailer_server/

To reload(or give up) consume: uwsgi --reload(give up) /home/serafeim/mailer_server/

Configuring workers

It’s a long way a need to to flee at the least one django-rq worker. I counsel the consume of supervisord with
my configuration from and loads others/mailer-server-rqworker-supervisord.conf. After the rqworker
is configured please consult with http://site_url: 8001/admin/django-rq/ – that you just would be in a position to most likely hold to
hold at the least 1 worker there.

The consume of supervisord

Please obtain the .conf on mailer_server/and loads others:

  1. mailer-server-redis-supervisord.conf for configuring native redis instance (the consume of a unix socket)
  2. mailer-server-uwsgi-supervisord.conf for running uwsgi through supervisord
  3. mailer-server-rqworker-supervisord.conf for configuring a worker

Running on home windows

I consume home windows as my constructing atmosphere and I generally of direction feel just like the youngster of a lesser god when attempting to flee
stuff on my dev env. Nonetheless this challenge can be flee on home windows (for constructing most effective)! Now, as a no longer contemporary tip, I suggest the following
directory constructing for a django challenge on home windows: Add a mailer_server guardian directory and inner it scheme
a python virtual atmosphere named venv and a mailer_server (cloned from github) that can hold and loads others.

  • Set up redis for home windows from right here: and flee it – it’ll listen on default port 6379
  • Explore that that you just would be in a position to most likely also furthermore set up redis in a WSL and it’ll work intellectual
  • Set off the virtual atmosphere: Sprint dovenv.bat from inner mailer_server/mailer_server
  • Set up this kit the consume of pip set up git+
  • Sprint the advance server from contained within the virtual env through rsp.bat
  • Sprint the home windows rq-worker from inner one other virtual env through win_rqworker.bat
  • Which you might now consult with 8000 and take care of a gaze at including jobs

Authentication and Authorization

Please configure the challenge to make consume of the intellectual authentication scheme; intellectual now it permits most effective LDAP (evaluate out for manufacturing settings).

To present permissions to your users it is most likely you’ll well want to first scheme a superuser (the consume of python createsuperuser) and then shuffle to the django-admin and give the Utility admin or Utility user perms to your users or groups.

Read More

Leave A Reply

Your email address will not be published.