本文整理汇总了Java中javax.mail.Session.setDebug方法的典型用法代码示例。如果您正苦于以下问题:Java Session.setDebug方法的具体用法?Java Session.setDebug怎么用?Java Session.setDebug使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javax.mail.Session
的用法示例。
在下文中一共展示了Session.setDebug方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: sendMsg
import javax.mail.Session; //导入方法依赖的package包/类
public boolean sendMsg(String recipient, String subject, String content)
throws MessagingException {
// Create a mail object
Session session = Session.getInstance(props, new Authenticator() {
// Set the account information session,transport will send mail
@Override
protected PasswordAuthentication getPasswordAuthentication() {
return new PasswordAuthentication(Constants.MAIL_USERNAME, Constants.MAIL_PASSWORD);
}
});
session.setDebug(true);
Message msg = new MimeMessage(session);
try {
msg.setSubject(subject); //Set the mail subject
msg.setContent(content,"text/html;charset=utf-8");
msg.setFrom(new InternetAddress(Constants.MAIL_USERNAME)); //Set the sender
msg.setRecipient(RecipientType.TO, new InternetAddress(recipient)); //Set the recipient
Transport.send(msg);
return true;
} catch (Exception ex) {
ex.printStackTrace();
System.out.println(ex.getMessage());
return false;
}
}
示例2: sendMail
import javax.mail.Session; //导入方法依赖的package包/类
private static void sendMail()
throws MessagingException, IOException {
Session session = Session.getInstance(getMailProps(), new javax.mail.Authenticator() {
@Override
protected PasswordAuthentication getPasswordAuthentication() {
return new PasswordAuthentication(
getVal("username"),
getVal("password"));
}
});
session.setDebug(getBoolVal("mail.debug"));
LOG.info("Compiling Mail before Sending");
Message message = createMessage(session);
Transport transport = session.getTransport("smtp");
LOG.info("Connecting to Mail Server");
transport.connect();
LOG.info("Sending Mail");
transport.sendMessage(message, message.getAllRecipients());
transport.close();
LOG.info("Reports are sent to Mail");
clearTempZips();
}
示例3: sendHtmlMail
import javax.mail.Session; //导入方法依赖的package包/类
/**
* 以HTML格式发送邮件
*
* @param mailInfo
* 待发送的邮件信息
*/
public boolean sendHtmlMail(MailSenderObj mailInfo) {
// 判断是否需要身份认证
MyAuthenticator authenticator = null;
Properties pro = mailInfo.getProperties();
// 如果需要身份认证,则创建一个密码验证器
if (mailInfo.isValidate()) {
authenticator = new MyAuthenticator(mailInfo.getUserName(), mailInfo.getPassword());
}
// 根据邮件会话属性和密码验证器构造一个发送邮件的session
Session sendMailSession = Session.getDefaultInstance(pro, authenticator);
sendMailSession.setDebug(true);// 设置debug模式 在控制台看到交互信息
try {
// 根据session创建一个邮件消息
Message mailMessage = new MimeMessage(sendMailSession);
// 创建邮件发送者地址
Address from = new InternetAddress(mailInfo.getFromAddress());
// 设置邮件消息的发送者
mailMessage.setFrom(from);
// 创建邮件的接收者地址,并设置到邮件消息中
String[] asToAddr = mailInfo.getToAddress();
if (asToAddr == null) {
logger.debug("邮件发送失败,收信列表为空" + mailInfo);
return false;
}
for (int i=0; i<asToAddr.length; i++) {
if (asToAddr[i] == null || asToAddr[i].equals("")) {
continue;
}
Address to = new InternetAddress(asToAddr[i]);
// Message.RecipientType.TO属性表示接收者的类型为TO
mailMessage.addRecipient(Message.RecipientType.TO, to);
}
// 设置邮件消息的主题
mailMessage.setSubject(mailInfo.getSubject());
// 设置邮件消息发送的时间
mailMessage.setSentDate(new Date());
// MiniMultipart类是一个容器类,包含MimeBodyPart类型的对象
Multipart mainPart = new MimeMultipart();
// 创建一个包含HTML内容的MimeBodyPart
BodyPart html = new MimeBodyPart();
// 设置HTML内容
html.setContent(mailInfo.getContent(), "text/html; charset=utf-8");
mainPart.addBodyPart(html);
// 将MiniMultipart对象设置为邮件内容
mailMessage.setContent(mainPart);
// 发送邮件
Transport.send(mailMessage);
logger.info("发送邮件成功。" + mailInfo);
return true;
} catch (MessagingException ex) {
logger.error("发送邮件失败:" + ex.getMessage() + Arrays.toString(ex.getStackTrace()));
}
return false;
}
示例4: main
import javax.mail.Session; //导入方法依赖的package包/类
public static void main(String[] args) {
Properties props = new Properties();
/** Parâmetros de conexão com servidor Gmail */
props.put("mail.smtp.host", "smtp.gmail.com");
props.put("mail.smtp.socketFactory.port", "465");
props.put("mail.smtp.socketFactory.class", "javax.net.ssl.SSLSocketFactory");
props.put("mail.smtp.auth", "true");
props.put("mail.smtp.port", "465");
Session session = Session.getDefaultInstance(props,
new javax.mail.Authenticator() {
protected PasswordAuthentication getPasswordAuthentication()
{
return new PasswordAuthentication("[email protected]", "tjm123456");
}
});
/** Ativa Debug para sessão */
session.setDebug(true);
try {
Message message = new MimeMessage(session);
message.setFrom(new InternetAddress("[email protected]")); //Remetente
Address[] toUser = InternetAddress //Destinatário(s)
.parse("[email protected]");
message.setRecipients(Message.RecipientType.TO, toUser);
message.setSubject("Enviando email com JavaMail");//Assunto
message.setText("Enviei este email utilizando JavaMail com minha conta GMail!");
/**Método para enviar a mensagem criada*/
Transport.send(message);
System.out.println("Feito!!!");
} catch (MessagingException e) {
throw new RuntimeException(e);
}
}
示例5: send
import javax.mail.Session; //导入方法依赖的package包/类
public void send(String to, String cc, String bcc, String subject,
String content, JavamailConfig javamailConfig)
throws MessagingException {
logger.debug("send : {}, {}", to, subject);
try {
Properties props = createSmtpProperties(javamailConfig);
String username = javamailConfig.getUsername();
String password = javamailConfig.getPassword();
// 创建Session实例对象
Session session = Session.getInstance(props, new SmtpAuthenticator(
username, password));
session.setDebug(false);
// 创建MimeMessage实例对象
MimeMessage message = new MimeMessage(session);
// 设置邮件主题
message.setSubject(subject);
// 设置发送人
message.setFrom(new InternetAddress(username));
// 设置发送时间
message.setSentDate(new Date());
// 设置收件人
message.setRecipients(RecipientType.TO, InternetAddress.parse(to));
// 设置html内容为邮件正文,指定MIME类型为text/html类型,并指定字符编码为gbk
message.setContent(content, "text/html;charset=gbk");
// 保存并生成最终的邮件内容
message.saveChanges();
// 发送邮件
Transport.send(message);
} catch (Exception ex) {
logger.error(ex.getMessage(), ex);
}
}
示例6: sendTextEmail
import javax.mail.Session; //导入方法依赖的package包/类
public static void sendTextEmail(String recvEmail) {
try {
Properties props = new Properties();
props.setProperty("mail.transport.protocol", "smtp");
props.setProperty("mail.host", "smtp.qq.com");
props.setProperty("mail.smtp.auth", "true");
props.put("mail.smtp.ssl.enable", "true");
props.put("mail.smtp.socketFactory.port", "994");
Session session = Session.getInstance(props, new Authenticator() {
@Override
protected PasswordAuthentication getPasswordAuthentication() {
return new PasswordAuthentication("463112653", "manllfvunnfwbjhh");
}
});
session.setDebug(true);
Message msg = new MimeMessage(session);
msg.setSubject("Hello Vme");
//整个邮件的MultiPart(不能直接加入内容,需要在bodyPart中加入)
Multipart emailPart = new MimeMultipart();
MimeBodyPart attr1 = new MimeBodyPart();
attr1.setDataHandler(new DataHandler(new FileDataSource("E:/workspaces/Archon/src/main/webapp/uploadfile/head_img/2601169057.png")));
attr1.setFileName("tip.pic");
MimeBodyPart attr2 = new MimeBodyPart();
attr2.setDataHandler(new DataHandler(new FileDataSource("E:/workspaces/Archon/src/main/webapp/uploadfile/head_img/1724836491.png")));
attr2.setFileName(MimeUtility.encodeText("哦图像"));
MimeBodyPart content = new MimeBodyPart();
MimeMultipart contentPart = new MimeMultipart();
MimeBodyPart imgPart = new MimeBodyPart();
imgPart.setDataHandler(new DataHandler(new FileDataSource("E:/workspaces/Archon/src/main/webapp/uploadfile/head_img/1724836491.png")));
imgPart.setContentID("pic");
MimeBodyPart htmlPart = new MimeBodyPart();
htmlPart.setContent("<h1><a href='www.baidu.com'>百度一下</a><img src='cid:pic'/></h1>", "text/html;charset=utf-8");
contentPart.addBodyPart(imgPart);
contentPart.addBodyPart(htmlPart);
content.setContent(contentPart);
emailPart.addBodyPart(attr1);
emailPart.addBodyPart(attr2);
emailPart.addBodyPart(content);
msg.setContent(emailPart);
msg.setFrom(new InternetAddress("[email protected]"));
msg.setRecipients(RecipientType.TO, InternetAddress.parse("[email protected],[email protected]"));
msg.setRecipients(RecipientType.CC, InternetAddress.parse("[email protected],[email protected]"));
Transport.send(msg);
} catch (Exception e) {
e.printStackTrace();
}
}
示例7: send
import javax.mail.Session; //导入方法依赖的package包/类
/**
* 发送邮件
*
* @param email-收件人
* @throws Exception
* @return new password
*/
public static String send(String email, String username) throws Exception {
String pwd = getRandomString(6);
// 2. 根据配置创建会话对象, 用于和邮件服务器交互
Session session = Session.getDefaultInstance(props);
session.setDebug(true); // 设置为debug模式, 可以查看详细的发送 log
// 3. 创建一封邮件
MimeMessage message = createMimeMessage(session, myEmailAccount, email, username,pwd);
// 4. 根据 Session 获取邮件传输对象
Transport transport = session.getTransport();
// 5. 使用 邮箱账号 和 密码 连接邮件服务器, 这里认证的邮箱必须与 message 中的发件人邮箱一致, 否则报错
//
// PS_01: 成败的判断关键在此一句, 如果连接服务器失败, 都会在控制台输出相应失败原因的 log,
// 仔细查看失败原因, 有些邮箱服务器会返回错误码或查看错误类型的链接, 根据给出的错误
// 类型到对应邮件服务器的帮助网站上查看具体失败原因。
//
// PS_02: 连接失败的原因通常为以下几点, 仔细检查代码:
// (1) 邮箱没有开启 SMTP 服务;
// (2) 邮箱密码错误, 例如某些邮箱开启了独立密码;
// (3) 邮箱服务器要求必须要使用 SSL 安全连接;
// (4) 请求过于频繁或其他原因, 被邮件服务器拒绝服务;
// (5) 如果以上几点都确定无误, 到邮件服务器网站查找帮助。
//
// PS_03: 仔细看log, 认真看log, 看懂log, 错误原因都在log已说明。
transport.connect(myEmailAccount, myEmailPassword);
// 6. 发送邮件, 发到所有的收件地址, message.getAllRecipients() 获取到的是在创建邮件对象时添加的所有收件人,
// 抄送人, 密送人
transport.sendMessage(message, message.getAllRecipients());
// 7. 关闭连接
transport.close();
return pwd;
}
示例8: send
import javax.mail.Session; //导入方法依赖的package包/类
/**
* @Title: send
* @Description: TODO(发送带附件的邮件)
* @author [email protected] (苟志强)
* @date 2017-6-6 下午4:29:56
* @param to 接收用户账户
* @param title 邮件标题
* @param content 邮件内容
* @param affix 附件路径
* @param affixName 发送后显示名称
* @return 是否发送成功
*/
public static boolean send(String to,String title,String content,String affix,String affixName) {
Properties props = new Properties();
//设置发送邮件的邮件服务器的属性(这里使用网易的smtp服务器)
props.put("mail.smtp.host", host);
//需要经过授权,也就是有户名和密码的校验,这样才能通过验证
props.put("mail.smtp.auth", "true");
//用刚刚设置好的props对象构建一个session
Session session = Session.getDefaultInstance(props);
//有了这句便可以在发送邮件的过程中在console处显示过程信息,供调试使
//用(你可以在控制台(console)上看到发送邮件的过程)
session.setDebug(true);
//用session为参数定义消息对象
MimeMessage message = new MimeMessage(session);
try{
//加载发件人地址
message.setFrom(new InternetAddress(from));
//加载收件人地址
message.addRecipient(Message.RecipientType.TO,new InternetAddress(to));
//加载标题
message.setSubject(title);
// 向multipart对象中添加邮件的各个部分内容,包括文本内容和附件
Multipart multipart = new MimeMultipart();
//设置邮件的文本内容
BodyPart contentPart = new MimeBodyPart();
contentPart.setText(content);
multipart.addBodyPart(contentPart);
//添加附件
if(affix!=null&&!"".equals(affix)&&affixName!=null&&!"".equals(affixName)){
BodyPart messageBodyPart= new MimeBodyPart();
DataSource source = new FileDataSource(affix);
//添加附件的内容
messageBodyPart.setDataHandler(new DataHandler(source));
//添加附件的标题
messageBodyPart.setFileName(MimeUtility.encodeText(affixName));
multipart.addBodyPart(messageBodyPart);
}
//将multipart对象放到message中
message.setContent(multipart);
//保存邮件
message.saveChanges();
// 发送邮件
Transport transport = session.getTransport("smtp");
//连接服务器的邮箱
transport.connect(host, user, pwd);
//把邮件发送出去
transport.sendMessage(message, message.getAllRecipients());
transport.close();
return true;
}catch(Exception e){
e.printStackTrace();
return false;
}
}
示例9: sendTextEmail
import javax.mail.Session; //导入方法依赖的package包/类
/**
*
* @param recvEmail 收件人可多个,用","隔开
* @param title 标题
* @param text 邮件内容
*/
public static void sendTextEmail(String recvEmail, String title, String text) {
try {
Properties props = new Properties();
props.setProperty("mail.transport.protocol", "smtp");
props.setProperty("mail.host", "smtp.qq.com");
props.setProperty("mail.smtp.auth", "true");
props.put("mail.smtp.ssl.enable", "true");
props.put("mail.smtp.socketFactory.port", "994");
Session session = Session.getInstance(props, new Authenticator() {
@Override
protected PasswordAuthentication getPasswordAuthentication() {
return new PasswordAuthentication("463112653", "manllfvunnfwbjhh");
}
});
session.setDebug(true);
Message msg = new MimeMessage(session);
msg.setSubject(title);
msg.setText(text);
msg.setFrom(new InternetAddress("[email protected]"));
msg.setRecipients(RecipientType.TO, InternetAddress.parse(recvEmail));
msg.setRecipients(RecipientType.CC, InternetAddress.parse(recvEmail));
Transport.send(msg);
} catch (Exception e) {
e.printStackTrace();
}
}
示例10: sendemail
import javax.mail.Session; //导入方法依赖的package包/类
/**
* Sends an email message.
*
* @param emailHost host name of the email server
* @param emailFrom "from" name to be used in email messages
* @param emailAddrs array of "to" names for email messages
* @param emailSubject initial part of the email "Subject" line
* @param msgtext The message text.
* @exception MessagingException DESCRIPTION
* @exception NoSuchProviderException DESCRIPTION
* @exception IOException DESCRIPTION
*/
void sendemail(
String emailHost,
String emailFrom,
String[] emailAddrs,
String emailSubject,
String msgtext)
throws MessagingException, NoSuchProviderException, IOException {
int ii;
// Convert strange chars to %xx hex encoding.
// Java's MimeMessage will automatically convert the ENTIRE
// message to some strange encoding if the message
// contains a single weird char.
StringBuffer finalBuf = new StringBuffer();
for (ii = 0; ii < msgtext.length(); ii++) {
char cc = msgtext.charAt(ii);
if ((cc >= 0x20 && cc < 0x7f)
|| cc == '\t'
|| cc == '\n'
|| cc == '\f'
|| cc == '\r') {
finalBuf.append(cc);
} else {
String hexstg = Integer.toHexString(cc);
if (hexstg.length() == 1) {
hexstg = '0' + hexstg;
}
finalBuf.append('%');
finalBuf.append(hexstg.toUpperCase());
}
}
boolean debug = false;
Properties props = new Properties();
if (debug) {
props.put("mail.debug", "true");
}
props.put("mail.smtp.host", emailHost);
Session session = Session.getInstance(props, null);
session.setDebug(debug);
MimeMessage msg = new MimeMessage(session);
msg.setFrom(new InternetAddress(emailFrom));
InternetAddress[] recips = new InternetAddress[emailAddrs.length];
for (ii = 0; ii < emailAddrs.length; ii++) {
recips[ii] = new InternetAddress(emailAddrs[ii]);
}
msg.setRecipients(RecipientType.TO, recips);
msg.setSubject(emailSubject);
msg.setContent(finalBuf.toString(), "text/plain");
Transport.send(msg);
}
示例11: sendPassword
import javax.mail.Session; //导入方法依赖的package包/类
public static void sendPassword(String receiveMailAccount, String password) throws Exception {
Properties props = new Properties();
props.setProperty("mail.transport.protocol", "smtp");
props.setProperty("mail.smtp.host", myEmailSMTPHost);
props.setProperty("mail.smtp.auth", "true");
Session session = Session.getDefaultInstance(props);
session.setDebug(true);
MimeMessage message = createMimeMessage(session, myEmailAccount, receiveMailAccount, password);
Transport transport = session.getTransport();
transport.connect(myEmailAccount, myEmailPassword);
transport.sendMessage(message, message.getAllRecipients());
transport.close();
}
示例12: sendMail
import javax.mail.Session; //导入方法依赖的package包/类
public boolean sendMail(String to,String otp) throws MessagingException
{
String host="smtp.gmail.com";
String username="";//emailid
String password="";//emailid password
String from=" ";// email from which u have to send
String subject="One Time Password";
String body="Your One Time passsword is "+otp;
boolean sessionDebug=false;
Properties props=System.getProperties();
props.put("mail.host",host);
props.put("mail.transport.protocol","smtp");
props.put("mail.smtp.starttls.enable","true");
props.put("mail.smtp.auth", "true");
props.put("mail.smtp.debug", "true");
props.put("mail.smtp.socketFactory.port", "465");
props.put("mail.smtp.socketFactory.class", "javax.net.ssl.SSLSocketFactory");
props.put("mail.smtp.socketFactory.fallback", "false");
props.put("mail.smtp.host", "smtp.gmail.com");
props.put("mail.smtp.port", "25");
Session mailSession=Session.getDefaultInstance(props,null);
mailSession.setDebug(sessionDebug);
Message msg=new MimeMessage(mailSession);
msg.setFrom(new InternetAddress(from));
InternetAddress [] address={new InternetAddress(to)};
msg.setRecipients(Message.RecipientType.TO,address);
msg.setSubject(subject);
msg.setSentDate(new Date());
msg.setText(body);
Transport tr=mailSession.getTransport("smtp");
tr.connect(host,username,password);
msg.saveChanges();
tr.sendMessage(msg,msg.getAllRecipients());
tr.close();
//Transport.send(msg);
return true;
}
示例13: sendMail1
import javax.mail.Session; //导入方法依赖的package包/类
public boolean sendMail1(String to,String passwrd, String link) throws MessagingException
{
String host="smtp.gmail.com";
String username=" ";//emailid
String password="";//emailid password
String from=" ";// email from which u have to send
String subject="Website Password";
String body="Your website password is "+passwrd+" Please click to reset "+link;
boolean sessionDebug=false;
Properties props=System.getProperties();
props.put("mail.host",host);
props.put("mail.transport.protocol","smtp");
props.put("mail.smtp.starttls.enable","true");
props.put("mail.smtp.auth", "true");
props.put("mail.smtp.debug", "true");
props.put("mail.smtp.socketFactory.port", "465");
props.put("mail.smtp.socketFactory.class", "javax.net.ssl.SSLSocketFactory");
props.put("mail.smtp.socketFactory.fallback", "false");
props.put("mail.smtp.host", "smtp.gmail.com");
props.put("mail.smtp.port", "25");
Session mailSession=Session.getDefaultInstance(props,null);
mailSession.setDebug(sessionDebug);
Message msg=new MimeMessage(mailSession);
msg.setFrom(new InternetAddress(from));
InternetAddress [] address={new InternetAddress(to)};
msg.setRecipients(Message.RecipientType.TO,address);
msg.setSubject(subject);
msg.setSentDate(new Date());
msg.setText(body);
Transport tr=mailSession.getTransport("smtp");
tr.connect(host,username,password);
msg.saveChanges();
tr.sendMessage(msg,msg.getAllRecipients());
tr.close();
//Transport.send(msg);
return true;
}
示例14: sendMail2
import javax.mail.Session; //导入方法依赖的package包/类
public boolean sendMail2(String to, String link) throws AddressException, MessagingException {
String host="smtp.gmail.com";
String username=" ";//emailid
String password="";//emailid password
String from=" ";// email from which u have to send
String subject="Website Password";
String body="Activation Link"+link+"Please click to reset "+link;
boolean sessionDebug=false;
Properties props=System.getProperties();
props.put("mail.host",host);
props.put("mail.transport.protocol","smtp");
props.put("mail.smtp.starttls.enable","true");
props.put("mail.smtp.auth", "true");
props.put("mail.smtp.debug", "true");
props.put("mail.smtp.socketFactory.port", "465");
props.put("mail.smtp.socketFactory.class", "javax.net.ssl.SSLSocketFactory");
props.put("mail.smtp.socketFactory.fallback", "false");
props.put("mail.smtp.host", "smtp.gmail.com");
props.put("mail.smtp.port", "25");
Session mailSession=Session.getDefaultInstance(props,null);
mailSession.setDebug(sessionDebug);
Message msg=new MimeMessage(mailSession);
msg.setFrom(new InternetAddress(from));
InternetAddress [] address={new InternetAddress(to)};
msg.setRecipients(Message.RecipientType.TO,address);
msg.setSubject(subject);
msg.setSentDate(new Date());
msg.setText(body);
Transport tr=mailSession.getTransport("smtp");
tr.connect(host,username,password);
msg.saveChanges();
tr.sendMessage(msg,msg.getAllRecipients());
tr.close();
//Transport.send(msg);
return true;
}
示例15: main
import javax.mail.Session; //导入方法依赖的package包/类
public static void main(String[] args) {
try {
final String host = "smtp.qq.com";// ����QQ�����smtp��������ַ
final String port = "25"; // �˿ں�
/*
* Properties��һ�����Զ�����������Session����
*/
final Properties props = new Properties();
props.setProperty("mail.smtp.host", host);
props.setProperty("mail.smtp.port", port);
props.setProperty("mail.smtp.auth", "true");
props.setProperty("mail.smtp.ssl.enable", "false");// "true"
props.setProperty("mail.smtp.connectiontimeout", "5000");
final String user = "******@qq.com";// �û���
final String pwd = "******";// ����
/*
* Session�ඨ����һ���������ʼ��Ի���
*/
final Session session = Session.getInstance(props, new Authenticator() {
@Override
protected PasswordAuthentication getPasswordAuthentication() {
// ��¼�û�������
return new PasswordAuthentication(user, pwd);
}
});
session.setDebug(true);
/*
* Transport�����������ʼ��� �������smtp��transport���Զ�����smtpЭ�鷢���ʼ���
*/
final Transport transport = session.getTransport("smtp");// "smtps"
transport.connect(host, user, pwd);
/*
* Message������������ʵ�ʷ��͵ĵ����ʼ���Ϣ
*/
final MimeMessage message = new MimeMessage(session);
message.setSubject("�ʼ�����");
// ��Ϣ�����߽���������(������ַ���dz�)���ռ��˿������dz��������趨��
message.setFrom(new InternetAddress(user, "��ʦ��"));
message.addRecipients(Message.RecipientType.TO, new InternetAddress[] {
// ��Ϣ������(�ռ���ַ���dz�)
// ��������dz�ò��û�п���Ч��
new InternetAddress("[email protected]", "��ʦ��"), });
message.saveChanges();
// �����ʼ����ݼ������ʽ
// ��һ���������Բ�ָ�����룬��"text/plain"�����ǽ�������ʾ�����ַ�
message.setContent("�ʼ�����..", "text/plain;charset=UTF-8");
// ����
// transport.send(message);
Transport.send(message);
transport.close();
} catch (final Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}