Use https://mailcatcher.me/ for local SMTP testing.
Download and configure with:
go get github.com/PursuanceProject/pursuemail
cd $(go env GOPATH)/src/github.com/PursuanceProject/pursuemail
cp .env-sample .env
# !!! Customize .env !!!
Postgres setup:
go get github.com/PursuanceProject/pursuemail
cd db
sudo -u postgres bash init_sql.sh
cd ..
Build and run:
go build
source .env # Sets 'PGPASSWORD' environment variable so pursuemail can use it
./pursuemail
curl -i localhost:9080/api/v1/email -d '{"email": "spam@pursuanceproject.org"}'
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 PursueMail 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": "team@pursuanceproject.org", "subject": "4 tasks due today!", "body": "4 tasks due today: ..."}}'
curl -i localhost:9080/api/v1/email/bulksend -d '{"emails": ["activist1@riseup.net", "activist2@riseup.net"], "email_data": {"from": "team@pursuanceproject.org", "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": "team@pursuanceproject.org", "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.