Hack Forums
[Java] Send an Email with JavaMail [Pictures, resources, and explained code included] - Printable Version

+- Hack Forums (https://hackforums.net)
+-- Forum: Tech (https://hackforums.net/forumdisplay.php?fid=444)
+--- Forum: Coding (https://hackforums.net/forumdisplay.php?fid=151)
+---- Forum: Software Development (https://hackforums.net/forumdisplay.php?fid=118)
+---- Thread: [Java] Send an Email with JavaMail [Pictures, resources, and explained code included] (/showthread.php?tid=3175368)



Send an Email with JavaMail [Pictures, resources, and explained code included] - Lottery. - Jan 13, 2013

Hey guys, today I will be teaching you how to use the JavaMail packages to send an Email. I haven't made a tutorial in a while so go easy on me if I get something wrong.

Step #1.

Download JavaMail. You can download the latest JavaMail API here. In this tutorial I am using version 1.4.5, which as of now is the latest, complete version.

Step #2.

Import your JavaMail package by configuring your build path.
Spoiler (Click to View)

Step #3.

Set up your (simple & basic) class file.
Spoiler (Click to View)

Now all you have to do is call sendMail() from one of your other class files. There are many uses for sending Emails by Java. Explore them for yourself. You can modify anything as you would like. As I said in the beginning, I haven't done a tutorial in a while, so tell me if I messed up or forgot something.

Thanks for viewing! I hope you learned something.

P.S. Tell me what you come up with. I would love to see what creative minds people have.


* - Victoria J - Jan 13, 2013

Edit: Read it now that it's finished

Nice simple tutorial, never read anything on Emailing with java. Doesn't look very bad to do.


* - Lottery. - Jan 13, 2013

(Jan 13, 2013 07:35 PM)Cucco Wrote:  Standing by...Ready to read this when posted

Yeah. Sorry. I am under 5 minutes away from being finished. HF has their buttons way to close. Thanks for waiting, I hope you'll like it.


Post re-uploaded. Sorry for the delay. I hope you guys like it.


* - Natecat33 - Jan 13, 2013

This is very simple code, could you perhaps make a tutorial on something more complicated, like retrieving and manipulating an email from a email server.


* - NeoSnw - Jan 14, 2013

Oh man, I was going to do a tutorial like this, congrats for beating me to it!

Good tutorial though, thanks!


* - redpois0n - Jan 14, 2013

Really nice tutorial, and well explained. Nice work.


* - Lottery. - Jan 14, 2013

Thanks all. I am glad you like it. I hope I explained it well enough, it's not a hard concept anyways.

I plan to make more tutorials in the future if you guys can give me some ideas, or something you'd like to learn.


* - Arbitrage - Jan 14, 2013

Thanks for sharing this tutorial, I'm going to try this out some time!


* - Lottery. - Jan 14, 2013

(Jan 14, 2013 03:57 PM)Senovit Wrote:  Thanks for sharing this tutorial, I'm going to try this out some time!

No problem. See what you can make with it. I have made some pretty interesting things myself, but I would like to see what others can com up with.


* - __init__ - Jan 14, 2013

Thanks for this tutorial, I'm going to make a simple email client with this tomorrow :)


* - Lottery. - Jan 14, 2013

(Jan 14, 2013 04:32 PM)Introverted Wrote:  Thanks for this tutorial, I'm going to make a simple email client with this tomorrow :)

No problem. I'm glad you guys like the tutorial.


* - matt - Jan 15, 2013

http://www.newocr.com/
a picture to text converter for all you leechers out there. :P
it works 100% no flaws.


* - Lottery. - Jan 15, 2013

(Jan 15, 2013 02:55 AM)Midnite Blue Wrote:  http://www.newocr.com/
a picture to text converter for all you leechers out there. :P
it works 100% no flaws.

Okay. The purpose of pictures is so people can see the code and know what it should looks like. Then they learn instead of copying and pasting it. It also gives them the opportunity to ask questions while they read.