29
Aug/06
0

Sending Email with Ant

I’ve been working on an Ant script to push file up to our development server – I’ll post this once I fix the code issue here but in the meantime I was also trying to get it to email me a summary of what it did. I got this working but it was throwing an error which bugged me. After endless digging on Google I finally found the solution and thought I’d post it here…

The error I was getting during my build:
Failed to initialise MIME mail: javax/mail/MessagingException

Turns out if you want to send email with Ant you need to add two JAR files:

mail.jar and exception.jar – these two JAR files can be found here:

Javamail
JavaBeans Activation Framework

Download these, extract them and find mail.jar (Javamail) and exception.jar (JAF).

Next I created a C:\jar directory. I can use this to store any additional jar files I may need in the future. Next you need to configure Eclipse:

  • Open Eclipse. Open the Windows -> Prefences dialog.
  • Select the Ant > Runtime node in the tree.
  • Select the Classpath tab and the “Ant Home Entries (Default)” node.
  • Click the “Add External JARS” button and add the two JAR files in the C:\jar directory.

Once I did this – no more errors during my build!

Possibly Related:

Tagged as:
Comments (0) Trackbacks (0)

No comments yet.

Sorry, the comment form is closed at this time.

No trackbacks yet.