コード例 #1
0
ファイル: EmailManager.java プロジェクト: Cauac/MailLibrary
 private Socket getOutGoingSocket() throws IOException {
   Socket s;
   if (info.isUseSSL()) {
     SSLSocketFactory sslsocketfactory = (SSLSocketFactory) SSLSocketFactory.getDefault();
     s = sslsocketfactory.createSocket(info.getOutgoingServerName(), info.getOutgoingPort());
   } else {
     s = new Socket(info.getOutgoingServerName(), info.getOutgoingPort());
   }
   return s;
 }
コード例 #2
0
ファイル: EmailManager.java プロジェクト: Cauac/MailLibrary
  public boolean sendMessage(Letter l) throws IOException, ProtocolException {
    boolean result = false;
    Socket s = this.getOutGoingSocket();
    PostProtocol protocol = this.getOutGoingProtocol(s);

    protocol.startSession(info.getOutgoingServerName());
    protocol.authorization(info.getUsername(), info.getPassword());
    result = protocol.sendMessage(l);
    protocol.closeSession();
    s.close();
    return result;
  }