JavaMail API tutorial for beginners and professionals with examples in eclipse on Basics, Core Classes, Sending Simple Emails, Attachment, HTML, Inline Images, Checking Emails, Fetching Emails, Authentication, Replying Emails, Forwarding Emails, Deleting Emails, Gmail SMTP server, SMTP servers, IMAP servers, POP3 servers and more.
Email:
Electronic mail refers to the method of exchanging digital messages from an author to one or more recipients over communications networks.
JavaMail API:
The JavaMail API provides a platform-independent and protocol-independent framework to for reading, composing, and sending emails.
Protocols supported in JavaMail API:
- SMTP
- POP
- IMAP
- MIME
- NNTP and others
1. SMTP:
SMTP is an acronym for Simple Mail Transfer Protocol. It provides a mechanism to deliver email.
2. POP:
POP is an acronym for Post Office Protocol. POP provides a mechanism to get the emails. It provides support for single mail box for each user.
3. IMAP:
IMAP is an acronym for Internet Message Access Protocol. It is an advanced protocol for receiving messages. It provides support for multiple mailboxes for each user. It also provides the facility to share a single mailbox among multiple users.
4. MIME:
MIME is an acronym for Multipurpose Internet Mail Extensions. MIME is not a mail transfer protocol. It defines the message information like format of the messages, attachments etc.
5. NNTP and others:
There are many protocols that are provided by third-party providers. Some of them are Network News Transfer Protocol (NNTP), Secure Multipurpose Internet Mail Extensions (S/MIME) etc.
JavaMail API architecture:
Java application uses JavaMail API to compose, send and receive emails. Java application uses the application-programming interface (JavaMail API) to send and receive mail messages. This part of the JavaMail API is protocol independent. JavaMail SPI (service provider interface) is a protocol specific part and used to plug in a provider of an e-mail service to the J2EE platform.
JavaMail API tutorial:
- JavaMail API core classes.
- JavaMail API sending email.
- Send email with example.
- Send email with attachment with example.
- Send HTML content with example.
- Send inline image with example.
- Send email through Gmail server using TLSconnection with example.
- Send email through Gmail server using SSL connection with example.
- Receiving emails with example.
- Receiving emails with attachments with example.
- Replying emails with example.
- Forwarding emails with example.
- Deleting emails with example.
JavaMail API Interview Questions: