Вы находитесь на странице: 1из 2

Introduction:

The JavaMail is an API that is used to compose, write and read electronic messages (emails).
The JavaMail API provides protocol-independent and platform-independent framework for
sending and receiving mails. For sending the email using JavaMail API, you need to load the two
jar files:

a. mail.jar
b. activation.jar

The mail.jar file contains the core API classes, while the pop3.jar and smtp.jar files contain the
provider implementations for the respective mail protocols.

The activation.jar file allows you to handle MIME (Multipurpose Internet Mail Extensions) types
accessible via binary data streams.

Working of program:

On start of the application, it checks for internet connectivity


- if internet connection is available then it displays an option to login to the Gmail account
or exit from the application.
- If internet connection is not available, then user will be prompted that there is no
internet connection.

For login, it prompts the user to enter Email ID and password.


If login is successful, then it provides user with options like
1.Send an e-mail
2.Receive/View the e-mail's
3.Logout, I'm running Late!
4.Exit from the application.
and prompts the user to select an option.

If the user selects option 1. Send an email,


the user is prompted to feed in detail to send mail like,
1. Enter recipients’ email id, email subject and body
2. Then prompts if the message has to be drafted,
- If yes then the message is stored in draft box else the email is sent to the recipient.

If the user selects option 2. Receive/View the emails


This displays the no. of emails in the mail box and displays the first 5 emails
Then prompts the user if he/she would like to respond to the emails
- if yes then user is asked to enter the email no to respond to
After the user enters email no. he/she is again provided with set of options like:
1.Delete
2.Reply
3.Forward
4: Read/View the email
5: I’m done with these E-mail's!

On selecting option 1, the email will be deleted.


On selecting option 2, the user is asked to type in the reply message and email will be sent.
On selecting option 3, the user is asked to type in the reply message and email will be sent.
On selecting option 4, the mail content will be displayed.
On selecting option 5 will get the user back to the previous menu

If the user selects option 3. Logout, I'm running Late!


- User will be logged out

If the user selects option 4. Exit from the application.


- Application will be closed for the user

Steps to run the program:

a. Open command prompt


b. Load the jar files: set classpath=mail.jar; activation.jar;.;
c. run by: java Mail

Note:

You can use the below mentioned email ID to login.

Email ID: krittika.irkal@gmail.com ; Password: Hello@123

To use your own Gmail Id, change the following in the settings:

1. On your computer, open Gmail.


2. In the top right, click Settings.
3. Click Settings.
4. Click the Forwarding and POP/IMAP tab.
5. In the "POP download" section, select Enable POP for all mail or Enable POP for mail
that arrives from now on.
6. In the "IMAP Access" section, select Enable IMAP
7. At the bottom of the page, click Save Changes.

Вам также может понравиться