package org.jetic.web.notepad;/**
 * Title:        经天网络
 * Description:
 * Copyright:    Copyright (c) 2000<br>
 * Company:      www.jetic.com  经天<br>
 * @author hover
 * @version 1.0
 */import java.io.*;
import sun.net.smtp.SmtpClient;
import org.jetic.util.Charset;/**
 * 发送简单的邮件
 */public class Sendmail implements Serializable {
    private String server   = "202.115.4.247";
    private String from     = "[email protected]";
    private String to       = "[email protected]";
    private String subject  = "文章转发--hover 的记事本";
    private String body     = "";    public void setServer(String server)    { this.server = server; }
    public String getServer()               { return this.server; }
    public void setFrom(String from)        { this.from = from; }
    public String getFrom()                 { return this.from; }
    public void setTo(String to)            { this.to = to; }
    public String getTo()                   { return this.to; }
    public void setSubject(String subject)  { this.subject = subject; }
    public String getSubject()              { return this.subject; }
    public void setBody(String body)        { this.body = body; }
    public String getBody()                 { return this.body; }    public void send()
            throws IOException {
        SmtpClient smtp = new SmtpClient(this.server);
        smtp.from(this.from);
        smtp.to(this.to);        PrintStream out = smtp.startMessage();
        out.println("From: " + this.from);
        out.println("To: " + this.to);
        out.println("Subject: " + Charset.LocalToNetwork(this.subject));
        out.println();
        out.println(Charset.LocalToNetwork(this.body));
        out.print("\r\n");
        out.flush();
        out.close();
        smtp.closeServer();
    }
}