- mail.jar from JavaMail API
- activation.jar from JAF API
I already downloaded and copied them into /usr/share/ant/lib folder, but still I got the error.
After google a while, I realized that Mac missed another jar file in its ant package, this time it is ant-javamail.jar! So when I just copied the ant-javamail.jar from the downloaded ant package into /usr/share/ant/lib folder, then every thing worked perfectly.
In summary, to make the mail task work in Mac, you need 3 jar files:
- mail.jar
- activation.jar
- ant-javamail.jar
Ant target to send email example (using gmail smtp server):
<target name="sendmail" description="send email"> <mail mailhost="smtp.gmail.com" mailport="25" user="${your.gmail.account}" password="${your.gmail.password}" ssl="true" from="${your.email.address}" tolist="${mail.recipient}" subject="Results of nightly build"> <message>This is a test email</message> </mail> </target>
Thanks for the tip.
ReplyDelete