快捷搜索:  as  2018  FtCWSyGV  С˵  test  xxx  Ψһ  w3viyKQx

和记娱乐安卓下载和_机器人论坛



package steeven;

/*

Calss:Sendmail

Author: steeven@kali.com.cn

QQ:7461522

Date:11/13/2001

Notes:

Find samples in main();

If you send mail only from/to intranet, change domain as u need.

Setup:

1. change host, mailFooter

*/

import java.util.*;

import java.sql.*;

import javax.mail.*;

import javax.mail.internet.*;

import javax.activation.*;

public class Sendmail extends和记娱乐安卓下载和 Common{

publ和记娱乐安卓下载和ic String host = "smtpServer";//smtp server

static String mailFooter = "

此邮件由WebMail发送 http://www/mail.jsp

";

String domain = "company";

boolean sessionDebug;

Message msg;

Multipart multipart;

public Sendmail() thro和记娱乐安卓下载和ws Exception{

Properties props = System.getProperties();

props.put("mail.host", host);

props.put("mail.transport.protocol", "smtp");

Session session = Session.getDefaultInstance(props, null);

// Set debug on the Session so we can see what is going on

// Passing false will not echo debug info, and passing true

// will.

session.setDebug(sessionDebug);

// Instantiate a new MimeMessage and fill it with the

// required information.

msg = new MimeMessage(session);

msg.setSentDate(new java.util.Date());

multipart = new MimeMultipart();

msg.setContent(multipart);

}

public Sendmail(String to, String from, S和记娱乐安卓下载和tring subject, String body) throws Exception{

this();

this.setSendTo(to);

this.setFrom(from);

this.setSubject(subject);

this.setBody(body);

}

public Sendmail(String[] to, String from, String subject, String body) throws Exception{

this();

this.setSendTo(to);

this.setFrom(from);

this.setSubject(subject);

this.setBody(body);

}

public void setHost(String host) thr和记娱乐安卓下载和ows Exception{

this.host=host;

}

void setFrom(String from) throws Exception{

msg.setFrom(new InternetAddress(from+"@"+domain));

}

void setSendTo(String[] to) throws Exception{

for (int i=0;i

您可能还会对下面的文章感兴趣: