Sending
Contents A)Sending Mail Using Command Line B)Sending Mail Using GUI
A) Sending Mail Using Command Line 1. Obtaining the Encoded Username and Password Using BASE64Encoder 2. Sending Mail
1. Obtaining the Encoded Username and Password Using BASE64Encoder
2. Sending Mail Encoded username Encoded password A blank line must be inserted before the content
B) Sending Mail Using GUI
Solution I.Developing the View II.Adding Listener to Send Button
I. Developing the View
II. Adding Listener to Send Button 1.Asking the MailSender to Send Mail 2.Developing MailSender 3.Clearing Some GUI Components
1. Asking the MailSender to Send Mail
2. Developing MailSender 2.1. Using Low Level Programming 2.2. Using JavaMail API
2.1. Using Low Level Programming Creating a Connection to the Mail Server Sending Mail to the Mail Server
Creating a Connection to the Mail Server
Sending Mail to the Mail Server
2.2. Using JavaMail API Installing JavaMail API Modifying the Design Changing MailSender to LowLevelMailSender Creating the MailSender Interface Hooking MailFrame to MailSender Developing JavaMailSender
Installing JavaMail API Download the JavaMail implementation Unbundle the javamail-[version].zip file Add the mail.jar file to project's CLASSPATH
Modifying the Design Current design
Modified design
Changing MailSender to LowLevelMailSender
Creating the MailSender Interface
Hooking MailFrame to MailSender
Developing JavaMailSender Getting a Session Developing the Message Sending the Message
Getting a Session
Developing the Message
Sending the Message
2.3. Clearing Some GUI Components
References 1. Core Java, Volume II – Advanced Features, Eighth Edition, Chapter 3. Cay S. Horstmann and Gary Cornell. Prentice Hall, jGuru: Fundamentals of the JavaMail API. vaMail/index.html