Processing E-Mails with Java
People send and receive e-mails using e-mail client programs such as Microsoft Outlook and Gmail. Can you write your own program to send and receive e-mails? The chances are slim that you’ll need to develop a client to compete with Gmail, but enterprise Java applications often need the ability to send or receive e-mails in certain conditions.
For example, an application that processes credit card transactions suspects a fraudulent activity and needs to send an e-mail to the account owner. Such an application becomes an e-mail client. A Java application provided by your bank can run on your Android smartphone and have an integrated e-mail inbox that accumulates all messages sent to you by the bank.
Another good example involves the forgotten-password functionality. A user clicks the Forgot Your Password? hyperlink and enters a valid e-mail address in a text input field. A couple of seconds later an e-mail containing instructions for resetting the password arrives in her e-mail inbox. The server-side Java program sent this e-mail automatically using JavaMail’s application program interface (API).
In this lesson you’ll learn how to write a Java program that can send e-mails reminding you about your friends’ birthdays.
Protocols and Servers
For e-mail messaging you’ll be using standard protocols: Simple Mail Transfer Protocol (SMTP) for sending e-mails and Post Office Protocol (POP) or Internet Message Access Protocol (IMAP) for retrieving ...