Ant - Mail

About

How to send a mail with Ant.

Prerequisite

The jar file mail.jar (https://mvnrepository.com/artifact/javax.mail/mail) must be in the lib dir of ant.

Example

SSL

<mail 

	  mailhost="smtp.example.com" 
	  mailport="465" 
	  subject="The wiki backup has completed (${backupZipFilePath})"
	  user="${env.ANT_MAIL_USER}"
	  password="${env.ANT_MAIL_PWD}"
	  enableStartTLS="true"
	  ssl="true"
	  messagefile="${logFilePath}">
		
		<from address="[email protected]"/>
		<to address="[email protected]"/>

		
</mail>

where:

  • the user and the password must be in clear text (not in base64)

STARTTLS only

<mail 
	  mailhost="smtp.example.com" 
	  mailport="587" 
	  subject="The wiki backup has completed (${backupZipFilePath})"
	  user="${env.ANT_MAIL_USER}"
	  password="${env.ANT_MAIL_PWD}"
	  enableStartTLS="true"
	  ssl="false"
	  messagefile="${logFilePath}">
		
		<from address="[email protected]"/>
		<to address="[email protected]"/>
		
</mail>

where:

  • the user and the password must be in clear text (not in base64)

Powered by ComboStrap