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!
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.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.