For a big Perl project I am working on for quite some time I decided to use Apache Ant for creating a distribution with all the Perl code and related files. Since Ant has a Mail task, I wanted to see if I could have the files that belonged to a distribution emailed to my customer automatically.
Read the rest of Using the Mail task in Apache Ant.
Hi,
This article solved my e-mail-sending Ant task; please keep this item for reference!
Cheers, Peter-Jan Bosch
Thanks for blogging on this! A google search turned up this page, and it quickly solved my can't-handle-MIME problems.
Two additional things to add for other readers:
1.) The mail.jar file that needs to be added to Ant\lib is located in the base directory of the JavaMail download; it is not in the lib directory.
2.) You may also need to set the charset="ISO-8859-1" attribute to the Ant mail task. Thunderbird reads emails fine with or without it but MS Outlook complains about an unsupported (Cp1252) charset that might otherwise be used.
Regards, Glen
Thank you for posting this, I was having the same exact problem trying to send an attachment, after adding those two jar files to my classpath i was sending attachments with no errors.
keep up the good work!
Arlen
Hi John,
Thanks for providing informative and elaborative article on sending mail using Ant. I am new to Ant and your article helped me greatly.
One Suggestion: Would be great if you as well let users know that having a Mail Server running on the computer machine where they are running the ANT tool, it would really help them get through it faster.
Thanks very much once again, Bharat
This article help me as well. Thanks
Jar files needed are:
mail.jar activation.jar
ANT HOME = e.g. C:\apache-ant-1.6.5 Save them in the {ANT_HOME}\lib directory
Thanks. Cpwere
i also faced the same problem stating MIME problem, but for yr information i already had set mail.jar n activation.jar files into ANT/lib folder path, so instead of having these jar , i was getting error during ANT mail send option.
So i just disable the anti- virus protection over the port 25, n wondered this time it is wrkg fine.
The article helped me to overcome the charset issues that I encountered. Now my problem is solved after I add the charset into
charset="ISO-8859-1"
Thanks, It is a great help
Hi, I have the two jars described above, I set the charset in my ant, but I still have the same problem. I'm runing ant 1.6.2 on Solaris.
My ant tag is the following:
(edit: have replaced the domain name with example.com, JB)
<target name="send_report">
<property name="report" value="report.html"/>
<mail from="JS"
messagemimetype="text/html"
charset="ISO-8859-1"
messagefile="${report}"
mailhost="<IP>"
tolist="JS@example.com"
subject="Build Report"/>
</target>
Thanks in advance.
Thanks for your help. This worked for me too. Best Regards, Mike
Thanks, this has been bugging me for months. Worked perfectly. Thank you
This was the first link from google on the error message and the solution worked for me as well.
Thanks, after placing mail.jar and activation.jar it is working for me.
-Kiran
Note that your comment doesn't show up immediately. I review each comment before I add it to this site.
Check the Follow this page option if you want to receive an email each time a comment is posted to this page, including yours. A link to turn this option off will be included with each email.
Internet adresses will be converted automatically. You can use the following notation to specify anchor text for a link: [url=http://example.com/]example text[/url].
hi
i am trying to use this ant mail task in my project but i am always getting error
i had already included mail.jar and activation.jar in my ant library..its very urgent can u help me to figure out the problem
(edit: have replaced the domain names with example.com, JB)
the error is