Use https://mailcatcher.me/ for local SMTP testing.
Download and configure with:
go get github.com/elimisteve/effectivemail
cd $(go env GOPATH)/src/github.com/elimisteve/effectivemail
cp .env-sample .env
# !!! Customize .env !!!
Postgres setup:
go get github.com/elimisteve/effectivemail
cd db
sudo -u postgres bash init_sql.sh
cd ..
Build and run:
go build
source .env # Sets 'PGPASSWORD' environment variable so effectivemail can use it
./effectivemail
curl -i localhost:9080/api/v1/email -d '{"email": "[email protected]"}'
In the below examples, the emails sent to users will be encrypted if
and only if their PGP keys are found in ~/.gnupg/pubring.gpg
,
otherwise they will be sent unencrypted.
If you want to tell EffectiveMail to only send an email if it is sent in
encrypted form, add "secure_only": true
to the top level of the JSON
POST body when doing any of the following API calls.
curl -i localhost:9080/api/v1/email/ec348de2-2430-46d6-9ed7-f65b12a4a75a/send -d '{"email_data": {"from": "[email protected]", "subject": "4 tasks due today!", "body": "4 tasks due today: ..."}}'
curl -i localhost:9080/api/v1/email/bulksend -d '{"emails": ["[email protected]", "[email protected]"], "email_data": {"from": "[email protected]", "subject": "2 tasks due today!", "body": "2 tasks due today in pursuance #827: ..."}}'
curl -i localhost:9080/api/v1/email/bulksend -d '{"ids": ["ec348de2-2430-46d6-9ed7-f65b12a4a75a", "451724a2-ddb8-4fd9-8336-819316c6019a"], "email_data": {"from": "[email protected]", "subject": "3 tasks due today!", "body": "3 tasks due today in pursuance #827: ..."}}'
Same as these above examples, but add "secure_only": true
at the top
level.
- Create a go client library
- Audit error messages, make sure nothing sensitive is being revealed
- Better handling of HTML vs. Text emails
- Support an "Email Settings" page where users can unsubscribe.
- Better bounce support. (If we spam a non existant email, we are likely to get marked as a spambot).
- Support a DELETE option? a PUT option?
- Currently the sending endpoints hold onto the connection until all emails are sent. May want to move this to a background worker with callback support.