Gmail Sender - send emails from the command line

I had an itch that needed to be scratched already - in a couple of servers I maintain I had to send a few emails from some scripts, and having to install an SMTP server seemed like an overkill - one more service to maintain, having to add the server's IP address to the SPF DNS field, making the life easier for possible spam trojans to be silently installed...

I thougth there had to be an easier way, but never put a couple of hourse into it. While migrating one server to docker I finally did it, and the result is Gmail Sender, a small CLI program that is written in Groovy and uses Gradle for managing the dependencies and allowing it to be launched from the command line.

At the beggining I though of a simple Groovy script with Grapes, but then I switched to Gradle for 2 reasons:

  • Easier to package as a library - so that it can be used not only from the command line, but from other services, such as Gmail Sender AAS.
  • Easier to launch from the command line - gradle provides the fantastic gradle wrapper, so using it only requires to have a JVM installed.

Gmail Sender supports HTML bodies, application-specific passwords, multiple addressees and can be launched using docker or can be added to another project as a maven dependency. For more details see the REAME page.