SMTP relay for sending emails via Gmail's API.
- Create a new project on Google Cloud Platform (optional) and activate the Gmail API, using the account you wish Freemaild to send emails from.
- Create an OAuth 2.0 Client ID for Freemaild to use, save the credential file as
freemaild.json
. - Grab an OAuth token for your gmail account. It will be saved to
/etc/freemaild/token.json
by default.
$ ./freemaild init
A link will be displayed on the console. Navigate to it in a browser, log into your desired Google account, and accept the dialogue after allowing your Freemaild instance to send emails on your behalf. Enter the token given from Google back into the console, creating your token.
- Run the server, specifying server address, listen port, and app credential file (from step 2) path via environment variables.
$ FREEMAILD_ADDRESS=127.0.0.1 FREEMAILD_PORT=2025 ./freemaild
- Send an email via SMTP to the server, it should forward it out to the recipient via your Gmail account!
A docker image is available and can be used as such:
$ docker run -it -v /etc/freemaild:/etc/freemaild ghcr.io/jan0ski/freemaild:latest [init]