A small tool that sends an email from a draft.
This tool was originally created for an AWS Lambda function being invoked by an AWS IoT button. The button's current purpose is to send an email to the local beverage dealer to order new beverages.
A few configuration values aside, this tool does not depend on any data stored in S3 or something else. The message template and the last send date are fetched via IMAP to allow simple adjustments on the template.
- Check if any messages, younger than a configurable timeout, are placed in the sent folder. If there are, no new mail is sent.
- Get a draft from draft folder
- Adjust some headers in the draft message
- Store the message in sent folder
- Send the message
The configuration of this tool is done by setting environment variables.
Defines the IMAP server address and port. Currently, plain IMAP is not supported.
Example:
IMAP_ADDR=imap.host.com:993
Defines the SMTP server address and port. Currently, plain SMTP is not supported.
Example:
SMTP_ADDR=smtp.host.com:465
The username to use for IMAP and SMTP login.
Example:
USER=user@host.com
The password to use for IMAP and SMTP login.
Example:
PASS=s3cr3tpassw0rd
The name of the mailbox (folder) that contains sent messages.
Example:
SENT_MBOX=Sent
The name of the mailbox (foldeR) that contains draft messages.
Example:
DRAFT_MBOX=Drafts
The number of days to wait until allowing the next email to be sent.
Example:
WAIT_DAYS=7
The IMAP search key to filter for a draft.
Example:
DRAFT_SEARCH="TO recipient@company.com"
- Use
SPECIAL-USE
to get sent and draft folder names - Make send interval configurable
- Enhance documentation
- Allow specification of sent search key
- Add tests
- Automate build
GNU General Public License v3.0
See LICENSE for full license text.