How can I set up Hudson CI so that I can send out emails from the server following a build failure? At the moment all I get is the following error:

com.sun.mail.smtp.SMTPSendFailedException: 530 5.7.0 Must issue a STARTTLS command first

One solution is to start Hudson as follows:

java -Dmail.smtp.starttls.enable="true" -jar /usr/share/hudson/hudson.war

However, I am already using the following to start Hudson:

sudo /etc/init.d/hudson start

I am thinking the solution is to somehow set the system property mail.smtp.starttls.enable in a property file somewhere, but I have no idea how to do that. What are my options?

Thank you all in advance!

3 Answers 3


Have a look in your /etc/init.d/hudson script (you'll need to prefix the edit command with sudo) and you will see a similar java command to the one you listed above. Just add the -Dmail.smtp.starttls.enable="true" paramter to that command and you should be good to go.

  • Thanks for your help Gareth. I changed the /etc/init.d/hudson script as you suggested but I only managed to get it to work after restarting the server! /etc/init.d/hudson restart did not work. In fact even /etc/init.d/hudson stop does not seem to stop hudson! How can I restart Hudson without restarting the server? Many thanks again! May 28, 2010 at 4:27
  • UPDATE! I found out that there were two daemon processes running for Hudson by using "pgrep daemon" and then using ps for each daemon pid. I simply stopped Hudson (using /etc/init.d/hudson stop) then killed the daemon that was still running and started Hudson (using /etc/init.d/hudson start) and we're good to go. May 28, 2010 at 4:51

I used this post to prepare my enviroment to send email that's was so helpful. For the other hand the best way to put extra parameters in java without change the hudson script is changing the hudson configuration file which define the default values for the system.

In my case i have used CentOS and the location file is /etc/sysconfig/hudson - stop the service first: service hudson stop - sudo vim hudson - Edit the variables that you need in the case of the post:

HUDSON_JAVA_OPTIONS="-Djava.awt.headless='true' -Dmail.smtp.starttls.enable='true'"

Save after edit and start hudson again: service hudson stop

I hope my comments could help


In ubuntu I added this by modifying the default jenkins file in /etc/default to add the JAVA_ARGS option. Then restarted jenkins for the change to take affect. Patch below.

--- /etc/default/jenkins.orig   2011-04-13 13:56:57.651180999 -0700
+++ /etc/default/jenkins        2011-04-13 14:23:38.651181002 -0700
@@ -8,6 +8,7 @@

 # arguments to pass to java


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.