import javax.mail.* ;
import java.util.* ;
import javax.mail.internet.* ;
import java.net.* ;
import javax.activation.* ;
import com.westerasoft.changqingzj.common.commsql.* ;
public class SendMaiBean
{
/**
* 网际邮件扩充协议消息对象
*/
private MimeMessage message = null ;
/**
* 发送器
*/
private Transport transport = null ;
/**
*session对象
*/
private Session session = null ;
private Multipart mm = new MimeMultipart() ;
/**
* 设置mail服务器
*/
public SendMaiBean(String mailServer) throws Exception
{
try
{
Properties props = new Properties() ;
props.put("mail.smtp.host",mailServer) ;
props.put("mail.smtp.auth", "true") ;
session = Session.getInstance(props) ;
session.setDebug(true) ;
message = new MimeMessage(session) ;
this.transport = this.session.getTransport("smtp") ;
}
catch (Exception e)
{
e.printStackTrace() ;
throw new Exception(ExceptionHandle.ERROR_PREFIX + "可能因为网络故障,连接邮件服务器失败!") ;
}
}
/**
* 设置发信人的用户名
* @throws Exception
*/
public void conn