In the third post of JavaMail, we learned how to send mail using the transport class provided by the JavaMail API, andJavaMail API Also provides some specialized classes to perform related operations on the receipt of messages, before introducing these classes, let us first understand the architecture of the mail recei
Use org. Apache. commons. Mail to send emails
The Commons project of Apache has an email subproject, which encapsulates the javamail API and makes it easy to use. Before you begin, make the following preparations:
1. javamail API
Add the mail package in javamail
This article gives an example of how the JavaMail sends a message with attachments in Java. Share to everyone for your reference. The specific analysis is as follows:
JavaMail, as the name suggests, provides a programming interface for developers to work with e-mail. It's a sun-released API for handling emails. It can easily perform some of the most commonly use
Attachments are resources associated with a mail message, usually kept outside of the "like a text file, Spreadshee T, or image. As with common mail programs like Eudora and pine, can attach resources to your mail and the JavaMail API and Get those attachments to receive the message.
Sending attachments:
Sending attachments is quite like forwarding messages. You build the parts to make the complete message
JavaMail, as the name implies, provides developers with programming interfaces for dealing with e-mail. It is the API that Sun releases to handle email. It is easy to perform some common mail transfer. We can develop an application similar to Microsoft Outlook based on JavaMail.The core classes used to process e-mail in the JavaMail package are :session,message,a
(mailsession );Message. setfrom (New internetaddress ("k445546363@sohu.com"); // senderMessage. addrecipient (message. recipienttype. To, new internetaddress ("linhe_150@163.com"); // recipientMessage. setsubject (title); // subjectMessage. settext (title); // mail contentMessage. savechanges ();Transport transport = mailsession. gettransport ("SMTP ");Transport. Connect (serversohu, "k44556363", "Jiangsu"); // This mailbox can be used at willTransport. sendmessage (message, message. getallreci
Settings for sending a message using javamail.
Full English, classic.
An SMTP protocol provider for the javamail API that provides access to an SMTP server. Refer to RFC 821 for more information.
The SMTP provider also supports ESMTP (RFC 1651). It can optionally use SMTP authentication (RFC 2554) using the login, plain, and DIGEST-MD5 mechanisms (RFC 2592 and
API for composite Mail organization structure:
The MimeMessage class represents an entire e-mail message.The MimeBodyPart class represents a MIME message for a message.The Mimemultipart class represents a combined MIME message that is composed of multiple MIME messages.Here's an example: The message contains two attachments, the body part includes plain text and hypertext, and the hypertext representation shows a picture. The source code is as fol
abstract class. You are using javax. Mail. Internet. internetaddressThe mail address class, like the message class, is also an abstract class, so we will use the javax. Mail. Internet. internetaddress subclass.4. authenticator classLike the java.net class, the javamail API uses the authenticator class to access the protected resources by using the user name and password. Here "resource" refers to the mail
Basic knowledge of JavaMailusing JavaMail is the component you need to send e-mail.JavaMail's organization makes it easy to process e-mail. Some of the classes we need are listed below:1. Properties
JavaMail requires properties to create a Session object. It will look for the string "Mail.smtp.host", the property value being the host that sent the message, such as:Properties Props = new properties ();Props
This article describes how to use javamail to send HTML-format emails through the SMTP server to be authenticated.First, download the implementation of javamail on the sun website, and add your classpath to the implementation of JAF (I don't know why I don't want to put it together.
The code first inherits a class from authenticator, such as smtpauthenticator, which is used for authentication when connectin
Transferred from: http://haolloyin.blog.51cto.com/1177454/353849/The JavaMail 1.4.3 version was downloaded in http://java.sun.com/products/javamail/, and if the JDK used is 6.0 then the activation is not downloaded. Download the javamail-1.4.3.zip of the compressed package, extract the Mail.jar package, configure the environment variables can be used. From the un
JavaMail API Using the Javax.mail.Message class to represent a message, the class of messages is an abstract class, so we need to use its subclass Javax.mail.internet.MimeMessage class to create an instance object of the class of messages, if we create a simple text message, Then the MimeMessage class will meet our needs, but if you need to create a complex message that contains embedded resources or with a
SSL-based javamail
Recently, a project needs to support SSL-based javamail to send and receive emails. After some investigation, the javamail method using SSL is summarized as follows.Javamail providers lack support for SSL connections. Therefore, JSSE APIs must be used to support SSL connections. The following describes how to use JSSE APIs to connect mail stor
3. Introduction to common classes of JavaMailInstructions in advance:Users who have never used JavaMail can understand these introductions, but it doesn't matter. There are specific examples in the subsequent articles. You can also come back to view the usage of these classes.(1) javax. mail. Properties classJavaMail needs Properties to create a session object. It will look for the string "mail. smtp. host". The attribute value is the host that sent t
3.JavaMail Common class Introduction
Prior description:
People who have never used javamail may not be able to understand these introductions, but it does not matter, the following articles have specific examples, and then can be inverted back to see the use of these classes.
(1) Javax.mail.Properties class
JavaMail requires properties to create a Session object.
-- Introduction to Start JavaMail
JavaMail is a package that is used to send e-mail, and Java EE (J2ee.jar) contains the package, but if you are using Java SE, you must first download the JavaMail package.
Download JavaMail
You can search for JavaMail download in Google and
I believe many people have MSN chat tools account, such as abc@hotmail.com, this account is actually a mail address, can be normal mail sending and receiving function, you can access and operate this mailbox through www.hotmail.com for sending and receiving emails. However, this mailbox does not provide POP3 or SMTP services, that is, JavaMailHotmail.
I believe many people have MSN chat tools account, such as abc@hotmail.com, this account is actually a mail address, can be normal mail sending
3.JavaMail Common class Introduction
Prior description:
People who have never used javamail may not be able to understand these introductions, but it does not matter, the following articles have specific examples, and then can be inverted back to see the use of these classes.
(1) Javax.mail.Properties class
JavaMail requires properties to create a Session object.
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.