View RSS Feed

Mail API

  1. Java Mail Authenticator

    by , 04-25-2012 at 11:09 PM
    Benefit of the Authenticator class might be taken by the Mail APIs, just like packages. Protected resources are being accessed by this class by using Username/Password. This resource might be simple file, server or anything else. In case of Java Mail, server would be the resource. In essence, Authenticator object gets passed to getInstance()/getDefaultInstance() method as a parameter which controls the Session object’s security aspect.

    Authenticator could be used by 2 methods. ...
  2. Java Mail Protocols

    by , 04-25-2012 at 11:07 PM
    Protocols are those rules which declare the format to do communication among systems. Main protocols for mailing systems are given below:
    1. SMTP
    2. IMAP
    3. POP
    4. MIME

    Let's consider them one by one.

    1. SMTP:

    SMTP i.e. Simple Mail Transfer Protocol defines email delivery mechanism. For mail transfer, mail client makes contact to organization’s SMTP server which send message in turn to the SMTP server recipient. IMAP or ...
    Mail API
  3. Read Multipart mail using Java Mail

    by , 04-25-2012 at 11:04 PM
    Multipart messages could be read by javamail api which has been shown in this example. Multipart class object is created to read the multipart mail.

    For composition of mails along with attachments, Multipart mail is being used now a days. One might attach the doc, images, zip files, xls etc. Mails that could be designed nicely are created by it.

    Classes are provided by the Java Mail API so that Multipart messages could be created, sent or read. Java Mail api is used ...
    Mail API
  4. Send multipart mail using java mail

    by , 04-25-2012 at 11:02 PM
    By the help of java mail how one could send multipart mails has been shown in this example. One might think a Multipart to be a container which contains more than one body parts. For sending the multipart mail, Multipart class object is made. After this BodyPart class object is created and text is set in the BodyPart class object which is then added to Multipart class object. Ultimately message is sent. In the given code, Class Multipart is abstract class. In this program, method of Multipart class ...
    Mail API
  5. Reading message using Java Mail

    by , 04-25-2012 at 10:58 PM
    To read the messages by the help of javamail api. , consider the given example. Folder Objects holds the stored messages. Folder might consist of messages or folders or both. Methods are declared by the Folder class so that to fetch, copy, append, copy or delete the messages. In this program, few used methods are given below:

    System.getProperties() system properties are obtained by this method.
    Session.getDefaultInstance(properties) Default Session object are obtained by this ...
    Mail API
  6. Java Mail API Store and folder

    by , 04-25-2012 at 10:56 PM
    When session is obtained, connection is made b/w javax.mail.Store & host, authenticator, port, username/password. Store objects which are involved in implementation of specified protocol might be formed by protocol information passage to the getStore() method.

    Java Code:
    // create object of store class.
    Store store = session.getStore("pop3");
    store.connect(host, username, password);
    After connecting to store you need to get a folder that holds ...
  7. Java Mail API Address

    by , 04-25-2012 at 10:54 PM
    Address class is considered to be the abstract class hence class javax.mail.internet.InternetAddress will be used here.

    Address address = new InternetAddress("");

    For name text to be displayed to Email add, one or more arguments shall be used for the name

    Java Code:
    Address address = new InternetAddress(“”, ”name”);
    After address has been created, make connection with message by 2 ways:

    1: ...
    Mail API
  8. Java Mail API Message

    by , 04-25-2012 at 10:51 PM
    When session object has been created, message is created so that to send it by the help of Message class. As message class is considered as abstract class hence subclass javax.mail.internet.MimeMessage will be used.
    Java Code:
    MimeMessage message = new MimeMessage(session) 
    // set the content of message by setContent() method
    message.setContent(“[url]”[/url], “text/plain”);
    setText() method can also be used to set the content.
    Java Code:
    Mail API
  9. Java Mail API Session

    by , 04-25-2012 at 10:49 PM
    Top leveled entry class that presents mailing session is known as session. java.util.Properties object is used for seeking information regarding username/password and mail server. Private constructor is present in this class and session objects can be obtained via getDefaultInstance() & getInstance() method. The default session object are provided by the getDefaultInstance() method where authenticator objects and properties are taken as arguments.

    Java Code:
    Properties props = new
    Mail API
  10. Apache Mail server (James)

    by , 04-25-2012 at 10:48 PM
    This section will discuss the James mail server. James is a portable and complete enterprise mailing server and a mailing app platform. Its latest version is found to be 2.3.1
    Mailet API

    This is basically a Java API which comes along James Mailing server. Developers are supported by it to develop mailing processing app quickly so that enterprise mailing problems could be solved. Flexible solutions for mail processing can be developed very easily and be deployed in production. ...
    Mail API
  11. Mailing protocols

    by , 04-25-2012 at 10:47 PM
    Standard methods are presented by a protocol used at every communication channel’s end so that the information could be transmitted properly.

    Four protocols send/receive Emails.

    (Simple Mail Transfer Protocol) SMTP: Email is delivered by SMTP to the mailing server of recipient. Communication is done by the Java mail applications with the ISP SMTP servers of user or company. SMTP servers send messages to the SMTP server of the recipient.

    (Post Office Protocol ...
    Mail API
  12. How does Email works

    by , 04-25-2012 at 10:42 PM
    Every DOMAIN consists of mailing server, when an email is sent by a user.

    1. Message is sent by email client program to the email server.
    2. Email server of recipient is contacted by the email server
    3. Validity of username is checked by the email server.
    4. If username is valid, email is sent to the email server of the address.
    5. When recipient signs in to his mailing account, he finds his email.

    Name:  1.jpg
Views: 6043
Size:  21.6 KB
    Mail API
  13. Introduction to Java Mail API

    by , 04-25-2012 at 10:39 PM
    Java Mail API provides an opportunity to the developers to do the additional functionalities of email, to the java app. This section details the introduction of the Java Mail API.
    A platform independent sort of framework is provided by the Java Mail API so that messaging & mail applications could be developed in Java technologies. This is protocol independent which makes it much more beneficial. Various protocols could be used to work with messages and mails.
    Java Mail API provides ...
    Mail API
  14. How to get e-mail with Java

    by , 02-29-2012 at 04:39 PM
    In the article “How to send e-mail with Java”, you are familiar with the JavaMail API on sending e-mail messages from a SMTP server. What about receiving e-mail messages? Well, that is the topic of this article. We will study how the JavaMail API exposes classes and interfaces for retrieving e-mail messages from a server, to write a utility class that checks for new messages in inbox of an e-mail account from Gmail server.

    Protocols for receiving e-mail

    There are two ...
    Mail API
  15. How to send e-mail with Java

    by , 02-29-2012 at 04:05 PM
    Sending an e-mail is a trivial task in the information world today. Billions of e-mails are sent everyday on the earth. For those who are Java developers, the ability to send e-mail from within a Java program is trivial also. However the standard Java platform does not include any e-mail functionality by default. Instead, developers have to use a separate library for the e-mail things, it is the JavaMail API. This article will guide you on how to write an email utility to send an e-mail out with ...
    Tags: java, javamail, mail, send Add / Edit Tags
    Mail API