java mail API required

I need an easy to use java mail API.

I will have a mail template where I would  send parameters to create mail content

also I will have a mail subject template where I would  send parameters to create subject content .

Can you suggest  a very easy to use mail api which I can use.

also a little example will help me a lot.
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Have you not tried the Java mail API that comes with Java?
Alternatively Apache Commons Email :
cofactorAuthor Commented:
I am using java 6.

It would better if I could put the template in a property file.  Is it possible ?

Is there any other API to look at ?

I want  simple and easy to use java mail API.
I haven't used Commons mail, so can't be certain, but the trouble with wrapped APIs in my experience is twofold:

a. they seldom simplify to any significant extent (if they did, it would imply the original API was badly designed)
b. you'd have access to much less support than the original API.

Moral of the story? Probably don't bother - use Java Mail

And yes, property files containing format strings (to be used with String.format) should be fine
Why Diversity in Tech Matters

Kesha Williams, certified professional and software developer, explores the imbalance of diversity in the world of technology -- especially when it comes to hiring women. She showcases ways she's making a difference through the Colors of STEM program.

cofactorAuthor Commented:


I believe you meant something like this ..

String message = "This message is for {0} in {1}.";
String result = MessageFormat.format(message, "me", "the next morning");

Ok....this looks fine.

However I want to send  mail in html format ? What settings I need to do in java mail ?
I believe you meant something like this ..
You could use that but in some ways MessageFormat has been superseded by String.format. There are a number of reasons you should use the latter, among them:

a. there are fewer steps to the goal
b. knowing printf notation will give you reusable skills

Using html requires really only two things:

a. setting the content type to text/html
b. using html in your format strings
cofactorAuthor Commented:
OK....this looks good.

I may need to send mails  to different groups . They all have separate email templates though.

Is it possible  to send batch mails using java mails  ? if so ?
Batching to different groups is done simply by adding more addresses to an array in the message. That too can be looked up in a properties file
cofactorAuthor Commented:
I meant this way ...

list of address of group 1 with template 1

list of address of group 2 with template 2

list of address of group 3 with template 3

Now send all mail  at one go.   Is it possible ?

This is where I am stuck.
That's three separate mails in one session

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.