jdk/src/java.base/share/classes/sun/net/smtp/SmtpClient.java
changeset 37593 824750ada3d6
parent 25859 3317bb8137f4
child 37781 71ed5645f17c
equal deleted inserted replaced
37592:c80f098887f4 37593:824750ada3d6
    23  * questions.
    23  * questions.
    24  */
    24  */
    25 
    25 
    26 package sun.net.smtp;
    26 package sun.net.smtp;
    27 
    27 
    28 import java.util.StringTokenizer;
       
    29 import java.io.*;
    28 import java.io.*;
    30 import java.net.*;
    29 import java.net.*;
    31 import sun.net.TransferProtocolClient;
    30 import sun.net.TransferProtocolClient;
       
    31 import sun.security.action.GetPropertyAction;
    32 
    32 
    33 /**
    33 /**
    34  * This class implements the SMTP client.
    34  * This class implements the SMTP client.
    35  * You can send a piece of mail by creating a new SmtpClient, calling
    35  * You can send a piece of mail by creating a new SmtpClient, calling
    36  * the "to" method to add destinations, calling "from" to name the
    36  * the "to" method to add destinations, calling "from" to name the
   155             } catch(Exception e) {
   155             } catch(Exception e) {
   156             }
   156             }
   157         }
   157         }
   158         try {
   158         try {
   159             String s;
   159             String s;
   160             mailhost = java.security.AccessController.doPrivileged(
   160             mailhost = GetPropertyAction.getProperty("mail.host");
   161                     new sun.security.action.GetPropertyAction("mail.host"));
       
   162             if (mailhost != null) {
   161             if (mailhost != null) {
   163                 openServer(mailhost);
   162                 openServer(mailhost);
   164                 return;
   163                 return;
   165             }
   164             }
   166         } catch(Exception e) {
   165         } catch(Exception e) {
   182     public SmtpClient(int to) throws IOException {
   181     public SmtpClient(int to) throws IOException {
   183         super();
   182         super();
   184         setConnectTimeout(to);
   183         setConnectTimeout(to);
   185         try {
   184         try {
   186             String s;
   185             String s;
   187             mailhost = java.security.AccessController.doPrivileged(
   186             mailhost = GetPropertyAction.getProperty("mail.host");
   188                     new sun.security.action.GetPropertyAction("mail.host"));
       
   189             if (mailhost != null) {
   187             if (mailhost != null) {
   190                 openServer(mailhost);
   188                 openServer(mailhost);
   191                 return;
   189                 return;
   192             }
   190             }
   193         } catch(Exception e) {
   191         } catch(Exception e) {