https://github.com/loggi/edwiges
A stupidly simple REST mail service
https://github.com/loggi/edwiges
Last synced: 5 days ago
JSON representation
A stupidly simple REST mail service
- Host: GitHub
- URL: https://github.com/loggi/edwiges
- Owner: loggi
- License: apache-2.0
- Created: 2017-07-20T22:10:25.000Z (almost 8 years ago)
- Default Branch: master
- Last Pushed: 2022-03-21T22:16:51.000Z (about 3 years ago)
- Last Synced: 2024-10-14T03:19:14.482Z (7 months ago)
- Language: Python
- Size: 144 KB
- Stars: 12
- Watchers: 6
- Forks: 0
- Open Issues: 4
-
Metadata Files:
- Readme: README.rst
- Changelog: CHANGELOG.rst
- License: LICENSE
Awesome Lists containing this project
README
Edwiges
=======**Under development!**
|travis|
.. |travis| image:: https://travis-ci.org/loggi/edwiges.svg?branch=master
:target: https://travis-ci.org/loggi/edwigesEdwiges is a simple service written in Python/Pyramid/Cornice
that can take a REST JSON request and use it to send emails using SMTP.
It does supports attachments and metainfo.The basic premise is that on a microservice architecture we don't want
all services to be able to send e-mails directly.
SMTP seems easy at first-glance, but it can get very tricky as you
include more complex features.
REST is idiomatic and easy to use in most languages, plus, by having
a separated service, you can get zero-cost monitoring and metrics.*As long term goals we want Edwiges to be able to handle everything
related to an email flow, such as consumable metrics, warnings,
rendering templates, scheduling, retrying and so on.*.. image:: https://pbs.twimg.com/profile_images/1361293504/coruja.jpg
:scale: 50 %
:align: rightRunning locally:
----------------Clone this repository and run:
.. code-block::
export EDWIGES_PROVIDER_HOST=YOUR_HOST
export EDWIGES_PROVIDER_USERNAME=YOUR_USER
export EDWIGES_PROVIDER_PASSWORD=YOUR_PASSWORDpython setup.py develop
pserve edwiges.ini --reload.. note::
You can also set the provider information on your .ini file.
With docker:
------------.. code-block::
export EDWIGES_PROVIDER_HOST=YOUR_HOST
export EDWIGES_PROVIDER_USERNAME=YOUR_USER
export EDWIGES_PROVIDER_PASSWORD=YOUR_PASSWORDdocker-compose up
API Quick Reference
-------------------*Note: these examples were performed using GMail, responses can change
according to the provider. You may need to enable
https://myaccount.google.com/lesssecureapps to use Edwiges with Gmail.***GET / - Server Test**
Request:
.. code-block:: json
$ http -v get localhost:10085
GET / HTTP/1.1
Accept: */*
Accept-Encoding: gzip, deflate
Connection: keep-alive
Host: localhost:10085
User-Agent: HTTPie/0.9.9Response:
.. code-block:: json
HTTP/1.1 200 OK
Content-Length: 62
Content-Type: application/json
Date: Sat, 22 Jul 2017 05:05:47 GMT
Server: waitress
X-Content-Type-Options: nosniff{
"errors": [],
"status": "2.0.0 OK s6sm4499738qki.44 - gsmtp"
}**POST /mail - Send Email**
Request:
.. code-block:: json
$ echo '{"sender": "[email protected]", \
"recipients": ["[email protected]"], \
"subject": "Grrr", \
"body": "Hello from edwiges"}' | http -v post localhost:10085/mail
POST /mail HTTP/1.1
Accept: application/json, */*
Accept-Encoding: gzip, deflate
Connection: keep-alive
Content-Length: 122
Content-Type: application/json
Host: localhost:10085
User-Agent: HTTPie/0.9.9{
"body": "Hello from edwiges",
"recipients": [
"[email protected]"
],
"sender": "[email protected]",
"subject": "Grrr"
}Response:
.. code-block:: json
HTTP/1.1 200 OK
Content-Length: 139
Content-Type: application/json
Date: Sat, 22 Jul 2017 05:04:22 GMT
Server: waitress
X-Content-Type-Options: nosniff{
"body": "Hello from edwiges",
"recipients": [
"[email protected]"
],
"sender": "[email protected]",
"status": "sent",
"subject": "Grrr"
}.. note::
Authentication has not been implemented yet, at Loggi we currently
protect the service API in production using a firewall, but pull requests
are very welcome. :)