|
9 | 9 |
|
10 | 10 | import org.apache.commons.mail.DefaultAuthenticator; |
11 | 11 | import org.apache.commons.mail.Email; |
12 | | -import org.apache.commons.mail.EmailException; |
13 | 12 | import org.apache.commons.mail.SimpleEmail; |
14 | 13 |
|
15 | 14 | import java.util.Properties; |
16 | 15 |
|
17 | 16 | class InsecureJavaMail { |
18 | 17 | public void testJavaMail() { |
19 | | - final Properties properties = new Properties(); |
20 | | - properties.put("mail.transport.protocol", "protocol"); |
21 | | - properties.put("mail.smtp.host", "hostname"); |
22 | | - properties.put("mail.smtp.socketFactory.class", "classname"); |
| 18 | + final Properties properties = new Properties(); |
| 19 | + properties.put("mail.transport.protocol", "protocol"); |
| 20 | + properties.put("mail.smtp.host", "hostname"); |
| 21 | + properties.put("mail.smtp.socketFactory.class", "classname"); |
23 | 22 |
|
24 | | - final javax.mail.Authenticator authenticator = new javax.mail.Authenticator() { |
25 | | - protected PasswordAuthentication getPasswordAuthentication() { |
26 | | - return new PasswordAuthentication("username", "password"); |
27 | | - } |
28 | | - }; |
29 | | - if (null != authenticator) { |
30 | | - properties.put("mail.smtp.auth", "true"); |
31 | | - // properties.put("mail.smtp.ssl.checkserveridentity", "true"); |
| 23 | + final javax.mail.Authenticator authenticator = new javax.mail.Authenticator() { |
| 24 | + protected PasswordAuthentication getPasswordAuthentication() { |
| 25 | + return new PasswordAuthentication("username", "password"); |
32 | 26 | } |
33 | | - final Session session = Session.getInstance(properties, authenticator); |
| 27 | + }; |
| 28 | + if (null != authenticator) { |
| 29 | + properties.put("mail.smtp.auth", "true"); |
| 30 | + // properties.put("mail.smtp.ssl.checkserveridentity", "true"); |
| 31 | + } |
| 32 | + final Session session = Session.getInstance(properties, authenticator); |
34 | 33 | } |
35 | 34 |
|
36 | 35 | public void testSimpleMail() { |
|
0 commit comments