tailieunhanh - Java Server Pages: A Code-Intensive Premium Reference- P17

Java Server Pages: A Code-Intensive Premium Reference- P17:Before you begin reading Pure JSP Java Server Pages, you might want to take a look at its basic structure. This should help you outline your reading plan if you choose not to read the text from cover to cover. This introduction gives you an overview of what each chapter covers. | Configuring JavaMail Before we get started you probably want to know what you will need in order to use the JavaMail API and where to get it. The JavaMail API can be downloaded from http products javamail The archive you will get contains the JavaMail API jar file all of the javadoc files the JavaMail Specification in PDF format the guide for service providers in PDF format and a decent collection of demo code with documentation. JavaMail makes extensive use of the JavaBeans Activation Framework JAF . So you will also need to download this Java extension. It can be found at http beans glasgow This archive contains a collection of files similar to the JavaMail archive. The two important files you will need are the and files. Both of these archives must be added to your classpath before you can begin working with JavaMail. A JavaMail Example Let s walk through a simple example of sending a message using JavaMail. Note The JavaMail API provides an interface to perform many more complex tasks including sending MIME-encoded attachments to your mail. And as we discussed earlier you can retrieve and manipulate messages from your mailboxes. The demo code that accompanies JavaMail gives good examples of some of the other features that you can use. With a little creativity you are not limited to what you can accomplish. Listing contains our JavaMail example. Listina import . import . import . import . public class SimpleSendMessage public static void main String args Collect the necessary information to send a simple message Make sure to replace the values for host to and from with valid information. host - must be a valid smtp server that you currently have access to. - 161 - to - whoever is going to get your email from - whoever you want to be. Just remember that many smtp servers will validate the domain of .

TỪ KHÓA LIÊN QUAN