1. Introduction to javamail API
Javamail API is a set of standard development kits provided by Sun to facilitate Java developers to send and receive emails in applications. It supports common mail protocols, such: SMTP, POP3, IMAP, and mime. When developers use the javamail
Javamail simulate mailbox function-delete mails-intermediate practice-[mail Tag Method] (javamail API email instance), javamailapi
Preface:
JavaMail jar package:Http://java.sun.com/products/javamail/downloads/index.html
This chapter may be the last article to explain
(parameter: TRUE)
As long as the previous practice, here will not wordy, ... omitted here .... 1w Word .....
JavaMail API Series:
JavaMail Email Demo Email-Basic Combat
JavaMail e-Mail Demo email-Intermediate Combat article "new attachment Sending method"
1. Introduction to javamail API
Javamail API is used to read, write, and send electronic messages.
Information. We can use it to create Mail User agents such as Eudora, Foxmail, and MS Outlook Express.
(Mail User Agent (Mua ). Instead of mail transfer agent
In this way, the MTA program can send, deliver, and forward em
Information Access Protocol)IMAP is an Internet message Access Protocol. The standard TCP port is 143, which also allows MUA to receive mail from the MTA. The target Ball IMAP protocol version is IMAP4.Both POP and IMAP can be used to collect mail, both in the client/server mode, and the main difference is that they retrieve the message in a different way. When you use POPs, messages reside on the server, and once you receive messages, messages are downloaded from the server to the user's compu
One of the advantages of using the spring framework is that it integrates with other technologies such as JavaMail, task scheduling, and caching strategies. This is explained in detail today in Java Mail. The JavaMail API is designed to be protocol agnostic, but for now we are not able to overcome the constraints of these protocols. Before you know
whether to update folder after the operation email is deleted.
H. Proceed!After explaining the definition and understanding of the above seven Java mail core classes and the simple code snippets, the following describes in detail how to use these classes to implement the advanced functions required by the javamail API.
5. Use javamail APIAfter clarifying how the
Using the JavaMail API provided by Sun, you can easily develop mail-sending programs. You may already be able to use it to send a simple text, but do you want to make your program send attachments like Outlook? After a brief introduction of JavaMail, this article explains in detail a complete messenger JavaBean and a very lightweight servlet.
(Readers without lo
With the development of Internet and the popularization of computer application, e-mail is becoming an important way of communication. At present, there are a variety of development tools that can be used to prepare mail-sending programs, which are easiest to use JavaMail API programming. This article provides a complete example of how to use the JavaMail
This article describes a method for sending and receiving messages based on the JavaMail API. Share to everyone for your reference. Specifically as follows:
The 1.JavaMail API can usually be divided into three main categories according to its function division
(1) The Api:message class for creating and parsing mail c
The program makes use of the JavaMail API provided by Sun Company to develop mail-sending programs easily. You may already be able to use it to send a simple text, but do you want to make your program send attachments like Outlook? After a brief introduction of JavaMail, this article explains in detail a complete messenger JavaBean and a very lightweight servlet.
Use JavaMail to send mail, required jar packs (please download JavaMail source file, official download page: http://www.oracle.com/technetwork/java/javamail/index-138643.html):Mailapi.jar. Defines the interface API used to send and receive messages;Smtp.jar. Contains the class used to send the message;Pop3.jar. Contain
In my previous article "Use JavaMail and JSP combined to write a simple e-mail delivery system," introduced the JavaMail and JSP in combination with the method. In fact, the JavaMail API is a fairly large system, only then a small text is not able to introduce the end of JavaMail
. addbodypart (messagebodypart); // create and fill part for the forwarded contentmessagebodypart = new mimebodypart (); messagebodypart. setdatahandler (message. getdatahandler (); // Add part to multi partmultipart. addbodypart (messagebodypart); // associate multi-part with messageforward. setcontent (multipart); // send messagetransport. send (forward );
7. attachmentsAttachments are often used as email-related resources in text, tables, images, and other formats, such as popular mail client
A: condition must download Sun's javamail API package, address: http://java.sun.com/products/javamail/
I use version 1.2 here and add the relevant package (JAR file) to classpath.
II. This program is very simple, and we don't need to consider a lot of ground layer things, because the API has helped us do these things
Now that we have a clear concept of the JavaMail API and its core classes, let's write a simple program that will send simple email messages with attachments, emails, HTML content and e-mail embedded images.Then the basic steps in all the above scenarios are as follows:
Gets the session object.
Compose a message.
Send a message.
In the following chapters, we have shown a simple example:
js|servlet| email I'm here with version 1.2, add the related package (jar file) to the Classpath
Second: The program is very simple, do not need us to consider a lot of strata of things, because the API to help us do these things, the following is a Simple mail servlet: (for familiar people, I am afraid is a simple servlet)
Import java.io.*;
Import javax.servlet.*;
Import javax.servlet.http.*;
Import sun.net.smtp.*;
public class Sendmailservlet
JavaMail (1): Use JavaMail to send a simple email and javamail to send
JavaMail provides developers with programming interfaces related to email processing. It is an API released by Sun to process emails. It can easily perform some common mail Transmission. But it is not inc
JavaMail entry 3: send an email, and javamail entry 3
The JavaMail API defines a java. mail. transport class, which is used to execute mail sending tasks. The instance objects of this class encapsulate the underlying implementation details of a mail sending protocol, by calling methods in this class, the application ca
Do you want to create an email sending and receiving tool in JSP? The following describes how to create an email sending and receiving tool in JSP. In this article
Article You can understand some key points of the javamail API and how to use it in JSP. This article also includes examples of using javamail in JSP. Javamail
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.