Node app that listens to MQTT queue on specific topic (can be found in ./src/config/config.json
) and processes the message to send an email
git clone https://github.com/dstil/mqtt-mailer.git
npm install
export MAILER_ADDRESS='[email protected]'
export MAILER_PWD='yourpassword'
npm start
You can add export
to ~/.profile
or ~/.bash_profile
to make it set up automatically during start up
MAILER_ADDRESS
has to be a GMAIL account
Expected mqtt message format
{
"receiver": "[email protected]",
"subject": "Email subject",
"message": "Your email body"
}
Email body can be in html format
Run test script npm test
to test if you set it up properly
or
You can manually publish a message to specified topic with mosquitto_pub
For example
mosquitto_pub -h localhost -t 'mail/test' -m '{"receiver": "[email protected]", "subject": "This is a test email", "message": "<H1>This is email body</H1>This email is only for testing"}'