Ant - Mail

> Ant

1 - About

How to send a mail with Ant.

2 - Prerequisite

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

3 - Example

3.1 - 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)
Advertising

3.2 - 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)