Update Jul 14, 2017
Mailgun Sender is an easy to use Java command line tool that you can use to send messages to mailing lists or email addresses using your Mailgun account.
No programming skills are required to use this tool.
Many people don't have the time or the skills to code against APIs. So, I built Mailgun Sender for you. All you need is your Mailgun account info and your message content in plain-text and html.
Incidentally, if code is your thing, this tool is built on top of my Mailgun Manager API.
- A computer running Java 7 or higher.
- A valid Mailgun account (Note: You'll need to know your public and private API keys to run the tool)
- Download and extract the latest release to an installation directory on your computer, e.g.,
~/Applications
. - Navigate to the installation directory.
- Before running Mailgun Sender for the first time, you'll need to configure two properties files (
mailgun.properties
andmailgun-sender.properties
) located in the/config
directory. - Open a terminal window on your computer, so that you can run Mailgun Sender using command line arguments
Set the publicApiKey
, privateApiKey
, and the domain
property values. The API keys can be found in your Mailgun's account settings.
# Mailgun account properties
baseUri = https://api.mailgun.net/v3
publicApiKey = pubkey-my-public-uuid
privateApiKey = key-my-private-uuid
domain = mg.example.com
Set the mailgun.sender.default.from.email
property value.
# Mailgun Sender properties
mailgun.sender.default.from.email=Support Team <support@example.com>
If you haven't already, open a terminal window on your computer.
Note: All messages sent via Mailgun Sender require a plain-text and HTML version of the email message content. Hence, the path to the plain-text and HTML files are passed via the command line using the
-p
and-h
options. Additionally, when sending messages there are several optional arguments, which include the following:
-c,--campaign-id <ID> Campaign identifier
-t,--test-mode-flag <Flag> Test mode flag [default: false]
-f,--from-email-address <Email> From email address [default set in mailgun-sender.properties]
-r,--reply-to-email-address <Email> Reply-to email address
$ java -jar mailgun-sender.jar -e johndoe@example.com -s 'Test Message from Mailgun Sender!' -p plain-text.txt -h content.html
Note: In this example, the default from email address (set in the mailgun-sender.properties
file) is being used because the -f
option was excluded.
Send message to a mailing list.
$ java -jar mailgun-sender.jar -m test@mg.example.com -s "Test Mailing List Message from Mailgun Sender" -p plain-text.txt -h content.html
Send a message to a mailing list and set the from email address option, -f
.
$ java -jar mailgun-sender.jar -m test@mg.example.com -f 'Postmaster <postmaster@mg.example.com>' -s "Test Mailling List Message from Mailgun Sender" -p plain-text.txt -h content.html
Send message to a list of recipients in the recipients.txt
file using the -R
option.
$ java -jar mailgun-sender.jar -R recipients.txt -s "Test Message to Recipients from a File" -p plain-text.txt -h content.html -f postmaster@mg.example.com -r support@skedi.zendesk.com
Note: In this example, the default from email address (set in the mailgun-sender.properties
file) is being overridden with -f
option and a reply-to email address is set using the -r
option.
Text file with a new line for each message recipient.
bob@gmail.com
john@mailgun.net
doe@mailgun.net
$ java -jar mailgun-sender.jar
Contributions can be made by following these steps:
- Fork it!
- Create your feature branch:
git checkout -b my-new-feature
- Commit your changes:
git commit -am 'Add some feature'
- Push to the branch:
git push origin my-new-feature
- Submit a pull request :D
If you have any questions, please don't hesitate to contact me at john@rodaxsoft.com.
This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. If a copy of the MPL was not distributed with this file, You can obtain one at http://mozilla.org/MPL/2.0/.