Sending an email from a JAVA application.
I’ve discovered another great tool this week – Febootimail.
It allows you to send an email from the command line – meaning that you can send an email from any JAVA application running on a windows OS. Not just basic emails, but HTML email, attachments etc.
STEP 1 Download & Install febootimail.exe:
The Febootimail application can be downloaded from the following location –
and look for the setup / installer EXE.
Once downloaded run the setup process – the default setup location is C:\Program Files\febooti Command line email\
When the install is complete navigate to the install directory and look for a file called febootimail.exe.
This is the EXE that you will call from your JAVA application. If you only intend running your application on your local pc then this is fine. I run it from a server side application, so copied febootimail.exe to a server location accessible from all the clients running my JAVA app.
STEP 2 Call Febootimail.exe From the Application:
The following is an extract from a simple class that will send an email.
cmd = “ C:\Program Files\febooti Command line email\febootimail.exe”; // LINE1
cmd += ” -SERVER mail.yourserver.net”;//LINE 2
cmd += ” -FROM email@example.com”; // LINE 3
cmd += ” -TO firstname.lastname@example.org” ; // LINE 4
cmd += ” -MSG This is the body of the email address”; // LINE 5
cmd += ” -HTML “; // LINE 6
cmd += ” -SUBJ This Is The Subject”; // LINE 7
cmd += ” -FROMNAME email@example.com”; // LINE 8
cmd += ” -AUTH AUTO -USER username -PASS password “; // LINE 9
Process p = Runtime.getRuntime().exec(cmd);
Line 1: Points JAVA to febootimain.exe. Change the location depending on where you placed the exe.
Line 2: Supply your mail server name.
Line 3: Supply a FROM address.
Line 4: the recipient email address.
Line 5: This is the message body. This could be HTML code.
Line 6: Tells febootimail.exe to expect HTML in the message body.
Line 7: Sets the subject.
Line 8: sets the from name – this will abear as the sender alias.
Line 9: The username and password for your mail server.