-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathEmail_Client.java
84 lines (56 loc) · 2.97 KB
/
Email_Client.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
// 200655N [K.Thivaharan]
// Please import javax.mail and add java.activation library before running Email_Client .
import java.util.InputMismatchException;
import java.util.Scanner;
public class Email_Client {
public static void main(String[] args) {
Email gmail =new Email(// Add your Email and Password as two seperate arguements);
Scanner scanner = null;
try {
scanner = new Scanner(System.in);
while(true){
System.out.println("\nEnter option type: \n"
+ "1 - Adding a new recipient\n"
+ "2 - Sending an email\n"
+ "3 - Printing out all the recipients who have birthdays\n"
+ "4 - Printing out details of all the emails sent\n"
+ "5 - Printing out the number of recipient objects in the application\n"
+ "-1- Exit application\n");
int option = scanner.nextInt();
switch(option){
case 1:
RecipientBook.addNew();
// Input format - Official: nimal,[email protected],ceo
break;
case 2:
gmail.composeNewMail();
//Input email, subject and content in command line one by one when prompted
break;
case 3:
RecipientBook.getTodayBDDayNames();
// Print recipients who have Birthday today
// Print recipients who have birthdays on the given input date
// Input format is - yyyy/MM/dd (ex: 2018/09/17)
break;
case 4:
UtilSerializeObjects.readFile();
// Input format - yyyy/MM/dd (ex: 2018/09/17)
// Print the details of all the emails sent on the input date
break;
case 5:
RecipientBook.getTotalRecipients();
//Print the number of recipient objects in the application
break;
case -1:
System.exit(0);
default :
System.out.println("Invalid entry");
}
}
}catch (InputMismatchException e){
System.out.println("Invalid Input");
}finally{
scanner.close();
}
}
}