亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? transport.java

?? java編寫的email客戶端軟件
?? JAVA
字號:

/**
 *  Transport.java
 *
 *  Bill Lynch
 *  CoolServlets.com
 *  April 21 1999
 *
 *  Email Package Version 1.1
 *
 *    Copyright (C) 1999  Bill Lynch
 *
 *    This program is free software; you can redistribute it and/or modify
 *    it under the terms of the GNU Library General Public License as published by
 *    the Free Software Foundation; either version 2 of the License, or
 *    (at your option) any later version.
 *
 *    This program is distributed in the hope that it will be useful,
 *    but WITHOUT ANY WARRANTY; without even the implied warranty of
 *    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *    GNU Library General Public License for more details.
 *
 *    You should have received a copy of the GNU Library General Public License
 *    along with this program; if not, write to the Free Software
 *    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 */

package com.coolservlets.email;

/**
 *  Transport class
 *
 *  This class is the class that actually sends an email by talking to an SMTP
 *  server.
 *
 *  What's changed in 1.1 (most changes to 1.1 occured in THIS class)
 *    1.  Improved the FROM field a little so that the correct error is thrown if
 *        the FROM is not included. (It's required inorder to send an email.)
 *    2.  Fixed the behavior of the "To" and "Cc" fields. In 1.0, multiple To's
 *        or Cc's would display as multiple copies of the first email address.
 *        There was no problem in sending, just displaying.
 *    3.  Brackets are no longer printed for a single email address:
 *        Before: <bill@coolservlets.com>
 *        After:  bill@coolservlets.com
 *
 *  SMTP documentation (RFC821) can be found at:
 *    http://freesoft.org/CIE/RFC/821/index.htm
 *
 *  This class also checks for errors. An exception is thrown if a connection
 *  to the SMTP server cannot be established.
 *  The message itself must have the FROM and TO fields specified. (Acutally,
 *  to send an email through SMTP, you don't need a FROM field. I decided to
 *  require it to prevent totally anonymous emails. However, you could take
 *  that requirement out if you wanted to.)
 *
 *  Here's how this class should be used:
 *
 *  Message msg = new Message(); // fill this up, ie, FROM, TO's, etc... (see Message class)
 *  Transport tr = new Transport( "yourHost.com", 25 ); // SMTP ports are 25 by default
 *  try
 *   {  tr.send( msg );
 *   }
 *  catch( TransportExeception te )
 *   { }
 *
 *  You should probably do something with the exception instead of ignoring it
 *  like I just did. :)
 *
 *  Public Methods:
 *    Transport()
 *    Transport( String smtpHost, int smtpPort )
 *    String getSmtpHost( )
 *    getSmtpPort( )
 *    void setSmtpHost( String smtpHost )
 *    void setSmtpPort( int smtpPort )
 *    void send( Message msg ) throws TransportException
 *
 *  Private Methods/Fields:
 *    String smtpHost;
 *    int smtpPort;
 *
 */

import java.io.*;
import java.net.*;
import java.util.*;

/**
 *  Transport class
 *
 *  This class
 */

public class Transport
{
  public Transport()
  {}
  /**
   *  Construct a Transport object by specifying a host and port.
   */
  public Transport( String smtpHost, int smtpPort )
  { this.smtpHost = smtpHost;
    this.smtpPort = smtpPort;
  }
  /**
   *  Returns the SMTP host (ie, smtpServer.coolservlets.com).
   */
  public String getSmtpHost( )
  { return smtpHost;
  }
  /**
   *  Returns the SMTP port number (usually 25).
   */
  public int getSmtpPort( )
  { return smtpPort;
  }
  /**
   *  Sets the SMTP host.
   */
  public void setSmtpHost( String smtpHost )
  { this.smtpHost = smtpHost;
  }
  /**
   *  Sets the SMTP port number.
   */
  public void setSmtpPort( int smtpPort )
  { this.smtpPort = smtpPort;
  }

  /**
   *  Sends the message by talking to a SMTP port.
   *
   *  Here's a quick bit of SMTP info (you DON'T need to know this to use this class):
   *
   *    To send an email via SMTP, simply connect to the SMTP server on
   *    port 25. Here's the basic X commands to send an email:
   *    (The ">" lines will be what is written back from the SMTP server)
   *    Also note, that I've removed my own server info with "x"'s
   *
   *    > 220 xxx.xxx.net ESMTP Sendmail 8.9.1/8.9.1; Thu, 1 Apr 1999 12:55:27 -0600 (CST)
   *    HELO yourHost.com
   *    > 250 xxx.xxx.net Hello xxx.xxx.xxx.net [000.000.000.000], pleased to meet you
   *    MAIL FROM: <yourName@yourPlace.com>
   *    > 250 <yourName@yourPlace.com>... Sender ok
   *    RCPT TO: <someoneYouKnow@theirPlace.com>
   *    > 250 <someoneYouKnow@theirPlace.com>... Recipient ok
   *    DATA
   *    > 354 Enter mail, end with "." on a line by itself
   *    From: Your Name <yourName@yourPlace.com>
   *    To: Someone You Know <someoneYouKnow@theirPlace.com>
   *    Subject: Hi There
   *    Hi, how's it going?
   *    Later!
   *    .
   *    > 250 MAA19177 Message accepted for delivery
   *    QUIT
   *
   */
  public void send( Message msg ) throws TransportException
  {
    try
    {
      Socket s = new Socket( this.smtpHost, this.smtpPort );
      PrintWriter out = new PrintWriter( s.getOutputStream() );
      // Successive versions of this class will get feedback from the SMTP server like so:
      // InputStreamReader in = new InputStreamReaders( s.getInputStream() );
      // This will allow for more robust error checking.

      // Say Hi...
      out.println( "HELO " + this.smtpHost );

      // FROM
      Address[] from = msg.getFrom();
      if( from == null || from.length == 0 )
        throw new TransportException( "No \"FROM\" specified." );
      /* added new "else" statement: 1.1 */
      /* This is necessary to make sure that the FROM is included */
      else
      { if( from[0].getAddress() != null && from[0].getAddress().length() > 0 )
         out.println( "MAIL FROM: <" + from[0].getAddress() + ">" );
        else
          throw new TransportException( "No \"FROM\" specified." );
      }

      // TO, CC, BCC (all are added to the recipient list)
      Address[] to = msg.getRecipients( RecipientType.TO );
      if( to == null || to.length == 0 )
        throw new TransportException( "No \"TO\" specified." );
      else
        for( int i=0; i<to.length; i++ )
          out.println( "RCPT TO: <"+ to[i].getAddress() +">" );

      Address[] cc = msg.getRecipients( RecipientType.CC );
      if( cc != null )
        for( int i=0; i<cc.length; i++ )
          out.println( "RCPT TO: <"+ cc[i].getAddress() +">" );

      Address[] bcc = msg.getRecipients( RecipientType.BCC );
      if( bcc != null )
        for( int i=0; i<bcc.length; i++ )
          out.println( "RCPT TO: <"+ bcc[i].getAddress() +">" );


      // Start of data section
      out.println( "DATA" );

      // From:
      if( from != null )
        out.println( "From: "+ ( (from[0].getPersonal() != null) ? from[0].getPersonal()+" " : "" )
                           + "<"+ from[0].getAddress() +">" );

      // To:
      if( to != null && to.length > 0 )
      {
        String line = "To: ";
        for( int i=0; i<to.length; i++ )
        {
          line += ( (to[i].getPersonal()!=null)
                     ? ( to[i].getPersonal() + " <" + to[i].getAddress() + ">" )
                     : ( to[i].getAddress() )
                     );
          if( i < to.length - 1 )
            line += ", ";
        }
        out.println( line );
      }

      // CC:
      if( cc != null && cc.length > 0 )
      {
        String line = "CC: ";
        for( int i=0; i<cc.length; i++ )
        {
          line += ( (cc[i].getPersonal()!=null)
                     ? ( cc[i].getPersonal() + " <" + cc[i].getAddress() + ">" )
                     : ( cc[i].getAddress() )
                     );
          if( i < cc.length - 1 )
            line += ", ";
        }
        out.println( line );
      }

      // Subject:
      if( msg.getSubject() != null )
        out.println( "Subject: "+ msg.getSubject() );

      // The text of the email:
      if( msg.getText() != null )
      { //out.println( new Date() ); // Uncomment for a timestamp in your message!
        out.println( msg.getText() );
      }

      // Signal to the smtp server that we're all done and then quit.
      out.println( "." );
      out.println( "QUIT" );
      out.close();

    }
    catch( IOException ioe )
    { throw new TransportException( "Error connecting to SMTP port." );
    }
  }

  private String smtpHost;
  private int    smtpPort;
}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
久久一区二区三区国产精品| 欧美日韩综合一区| 国产69精品久久99不卡| 欧美日韩久久不卡| 中文字幕av一区二区三区高| 爽爽淫人综合网网站| 成人精品视频网站| 精品欧美一区二区久久| 亚洲成人综合在线| 99riav一区二区三区| www亚洲一区| 日韩黄色小视频| 日本电影亚洲天堂一区| 国产精品欧美久久久久一区二区| 麻豆久久一区二区| 91精品国产高清一区二区三区蜜臀| 国产精品成人网| 国产成人av电影在线| 日韩一区二区在线观看| 亚洲福利一二三区| 欧美色图天堂网| 艳妇臀荡乳欲伦亚洲一区| 国产91丝袜在线播放0| 久久影院视频免费| 伦理电影国产精品| 日韩午夜激情视频| 日韩电影在线免费| 在线不卡免费av| 婷婷开心久久网| 欧美高清视频不卡网| 亚洲va中文字幕| 欧美高清视频www夜色资源网| 亚洲不卡av一区二区三区| 欧美日韩中文字幕精品| 亚洲成人精品影院| 欧美顶级少妇做爰| 男女男精品视频网| 中文字幕亚洲精品在线观看 | 2021中文字幕一区亚洲| 日韩av电影一区| 欧美大肚乱孕交hd孕妇| 精品综合免费视频观看| 久久综合九色欧美综合狠狠| 国产成+人+日韩+欧美+亚洲| 国产欧美一区在线| 99久久精品久久久久久清纯| 一区二区三区日韩精品视频| 欧美女孩性生活视频| 免费在线观看一区| 国产亚洲欧美日韩日本| 国产成人99久久亚洲综合精品| 国产精品国产馆在线真实露脸| 色综合久久综合| 日韩精品一卡二卡三卡四卡无卡| 日韩欧美在线综合网| 国产一区二区在线视频| 国产精品高清亚洲| 在线播放日韩导航| 国产精品一区二区三区乱码| 国产精品不卡一区| 9191成人精品久久| 国产成人av网站| 亚洲影院久久精品| 久久综合一区二区| 91成人在线免费观看| 美洲天堂一区二卡三卡四卡视频| 国产亚洲精品7777| 在线精品视频免费观看| 久久不见久久见免费视频7 | 在线观看免费亚洲| 免费高清在线视频一区·| 国产欧美一区二区在线| 在线免费观看日本欧美| 国产美女久久久久| 亚洲一级二级在线| 欧美极品美女视频| 欧美一区二区黄| 91在线观看免费视频| 久久成人免费网| 亚洲国产综合91精品麻豆| 国产午夜精品一区二区| 欧美精选在线播放| 成人黄色电影在线| 久久精品国产澳门| 亚洲福中文字幕伊人影院| 国产日本亚洲高清| 欧美一区二区在线播放| 99久久精品国产一区| 黄网站免费久久| 午夜国产不卡在线观看视频| 国产精品不卡视频| 久久一二三国产| 这里只有精品99re| 欧美视频一区二区三区| 成人毛片老司机大片| 久草精品在线观看| 日韩专区一卡二卡| 亚洲成人精品影院| 亚洲伦理在线免费看| 中文字幕欧美一| 欧美激情艳妇裸体舞| 精品免费视频.| 欧美一级午夜免费电影| 欧美人与z0zoxxxx视频| 色狠狠综合天天综合综合| 不卡大黄网站免费看| 福利电影一区二区三区| 国产精品一区在线| 国产真实乱子伦精品视频| 欧美aⅴ一区二区三区视频| 亚洲成人第一页| 午夜影视日本亚洲欧洲精品| 亚洲午夜国产一区99re久久| 亚洲精品高清在线| 亚洲综合在线视频| 一区av在线播放| 亚洲午夜私人影院| 亚洲一区二区三区四区五区中文| 一区二区三区视频在线观看| 一区在线观看免费| 亚洲精品国产品国语在线app| 亚洲欧美日韩久久| 一区二区三区小说| 亚洲午夜国产一区99re久久| 亚洲狠狠爱一区二区三区| 亚洲国产精品视频| 免费一级欧美片在线观看| 美国毛片一区二区| 国产精品一区二区三区99| 国产一区二区三区香蕉| 岛国一区二区在线观看| 91免费在线看| 欧美日韩在线播放一区| 欧美一区二区视频在线观看 | 91麻豆精品国产91久久久资源速度| 欧美自拍偷拍午夜视频| 4438成人网| 久久免费视频一区| 国产精品国产自产拍高清av | 奇米影视7777精品一区二区| 久久99国产精品久久99果冻传媒| 国产成人欧美日韩在线电影| 91在线观看地址| 在线不卡免费av| 国产日韩欧美麻豆| 悠悠色在线精品| 久久99精品一区二区三区三区| 国产传媒一区在线| 在线视频一区二区三| 日韩欧美一区二区免费| 亚洲欧美一区二区在线观看| 天堂va蜜桃一区二区三区 | 一区二区三区高清在线| 青青草国产成人99久久| 床上的激情91.| 欧美日韩黄色影视| 久久精品欧美日韩| 亚洲成a人在线观看| 国产成人精品免费看| 欧美精品777| 亚洲三级电影网站| 狠狠色狠狠色综合日日91app| 91老司机福利 在线| 日韩精品一区二区在线| 亚洲精品成人精品456| 国产九色精品成人porny| 欧美日韩美少妇| 国产精品美女久久久久av爽李琼| 无码av中文一区二区三区桃花岛| 成人免费观看视频| 日韩丝袜情趣美女图片| 夜夜爽夜夜爽精品视频| 丁香亚洲综合激情啪啪综合| 91精品国产欧美日韩| 亚洲欧美偷拍另类a∨色屁股| 国产在线观看免费一区| 777奇米四色成人影色区| 亚洲精品福利视频网站| 成人精品高清在线| 久久亚洲综合色一区二区三区| 亚洲一区二区精品视频| 91视频免费看| 国产精品成人一区二区艾草 | 亚洲一区影音先锋| 一本大道久久a久久综合| 国产欧美日产一区| 国产精品自拍网站| 久久五月婷婷丁香社区| 欧美aaaaaa午夜精品| 欧美精品亚洲一区二区在线播放| 亚洲摸摸操操av| 99re成人精品视频| 成人欧美一区二区三区在线播放| 精品亚洲国产成人av制服丝袜| 欧美精品高清视频| 亚洲第一二三四区| 欧美性猛交xxxx乱大交退制版| 亚洲丝袜另类动漫二区| 91视频com| 亚洲综合色成人|