home *** CD-ROM | disk | FTP | other *** search
/ PC Online 1999 November / PCONLINE_11_99.ISO / filesbbs / OS2 / APCHSSL2.ZIP / OS2HTTPD / jserv / com / bitmechanic / smtp / MailMessage.class (.txt) < prev   
Encoding:
Java Class File  |  1999-02-02  |  2.8 KB  |  131 lines

  1. package com.bitmechanic.smtp;
  2.  
  3. import java.util.Hashtable;
  4. import java.util.Vector;
  5.  
  6. public class MailMessage {
  7.    private Vector toList;
  8.    private Vector ccList;
  9.    private Vector bccList;
  10.    private String from;
  11.    private String subject;
  12.    private StringBuffer body;
  13.    private Hashtable headers;
  14.  
  15.    public MailMessage(String[] var1, String var2, String var3, String var4) {
  16.       this();
  17.       this.body.append(var4);
  18.       this.from = var2;
  19.       this.subject = var3;
  20.       if (var1 != null) {
  21.          for(int var5 = 0; var5 < var1.length; ++var5) {
  22.             this.addTo(var1[var5]);
  23.          }
  24.       }
  25.  
  26.    }
  27.  
  28.    public MailMessage(String var1, String var2, String var3, String var4) {
  29.       this();
  30.       this.body.append(var4);
  31.       this.from = var2;
  32.       this.subject = var3;
  33.       this.addTo(var1);
  34.    }
  35.  
  36.    public MailMessage() {
  37.       this.headers = new Hashtable();
  38.       this.toList = new Vector();
  39.       this.ccList = new Vector();
  40.       this.bccList = new Vector();
  41.       this.body = new StringBuffer();
  42.    }
  43.  
  44.    public void addTo(String var1) {
  45.       this.toList.addElement(var1);
  46.    }
  47.  
  48.    public String[] getToList() {
  49.       String[] var1 = new String[this.toList.size()];
  50.       this.toList.copyInto(var1);
  51.       return var1;
  52.    }
  53.  
  54.    public void clearToList() {
  55.       this.toList.removeAllElements();
  56.    }
  57.  
  58.    public void addCC(String var1) {
  59.       this.ccList.addElement(var1);
  60.    }
  61.  
  62.    public String[] getCCList() {
  63.       String[] var1 = new String[this.ccList.size()];
  64.       this.ccList.copyInto(var1);
  65.       return var1;
  66.    }
  67.  
  68.    public void clearCCList() {
  69.       this.ccList.removeAllElements();
  70.    }
  71.  
  72.    public void addBCC(String var1) {
  73.       this.bccList.addElement(var1);
  74.    }
  75.  
  76.    public String[] getBCCList() {
  77.       String[] var1 = new String[this.bccList.size()];
  78.       this.bccList.copyInto(var1);
  79.       return var1;
  80.    }
  81.  
  82.    public void clearBCCList() {
  83.       this.bccList.removeAllElements();
  84.    }
  85.  
  86.    public void setFrom(String var1) {
  87.       this.from = var1;
  88.    }
  89.  
  90.    public String getFrom() {
  91.       return this.from;
  92.    }
  93.  
  94.    public void setSubject(String var1) {
  95.       this.subject = var1;
  96.    }
  97.  
  98.    public String getSubject() {
  99.       return this.subject;
  100.    }
  101.  
  102.    public void setBody(String var1) {
  103.       this.body.setLength(0);
  104.       this.body.append(var1);
  105.    }
  106.  
  107.    public void appendBody(String var1) {
  108.       this.body.append(var1);
  109.    }
  110.  
  111.    public String getBody() {
  112.       return this.body.toString();
  113.    }
  114.  
  115.    public void clearBody() {
  116.       this.body.setLength(0);
  117.    }
  118.  
  119.    public void addHeader(String var1, String var2) {
  120.       if (var2 == null) {
  121.          this.headers.remove(var1);
  122.       } else {
  123.          this.headers.put(var1, var2);
  124.       }
  125.    }
  126.  
  127.    public Hashtable getHeaders() {
  128.       return this.headers;
  129.    }
  130. }
  131.