Haoest
Haoest

Reputation: 13916

how to send smtp mail in java 1.5?

So this is an old app, I don't have access to javax mail components. What are my options to send out email from a java app, please?

Upvotes: 1

Views: 914

Answers (4)

Stephen C
Stephen C

Reputation: 719576

You can download the JAR file containing the javax.mail APIs from Maven Central - http://mvnrepository.com/artifact/com.sun.mail/javax.mail/1.4.4

(Or if you are using Maven or Ivy, just add the dependency.)

Upvotes: 1

anubhava
anubhava

Reputation: 786091

If you can't (or don't want to) access javax package then only option you have to open socket connection with your SMTP server and send all the SMTP commands programmatically.

Upvotes: 1

James B
James B

Reputation: 3750

You can connect to the smtp port of the server you wish to communicate with using a java.io.URLConnection and pipe it the various smtp commands, try the example entitled "Example 5-3: The MailClient Class" here: http://oreilly.com/catalog/javaio/chapter/ch05.html

Or there's another example here: http://www.devx.com/tips/Tip/14877

Upvotes: 1

Wojciech Owczarczyk
Wojciech Owczarczyk

Reputation: 5745

Try this:

http://www.devx.com/tips/Tip/15120

Upvotes: 1

Related Questions