forked from hacker85/JavaLessons
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathEmailLesson.java
More file actions
23 lines (21 loc) · 904 Bytes
/
EmailLesson.java
File metadata and controls
23 lines (21 loc) · 904 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
package network;
import java.io.IOException;
import java.util.Properties;
public class EmailLesson {
public static void main(String[] args) throws IOException {
// final Properties properties = new Properties();
// properties.load(EmailLesson.class.getClassLoader().getResourceAsStream("mail.properties"));
//
// Session mailSession = Session.getDefaultInstance(properties);
// MimeMessage message = new MimeMessage(mailSession);
// message.setFrom(new InternetAddress("myemail"));
// message.addRecipient(Message.RecipientType.TO, new InternetAddress("[email protected] "));
// message.setSubject("hello");
// message.setText("Hi this is my test message");
//
// Transport tr = mailSession.getTransport();
// tr.connect(null, "123");
// tr.sendMessage(message, message.getAllRecipients());
// tr.close();
}
}