赞
踩
- public void sendMail() throws IOException {
- // create some properties and get the default Session
- Properties props = new Properties();
- props.put("mail.smtp.host", "smtp.sina.com.cn");
- props.setProperty("mail.smtp.auth", "true"); //这个必须加上 否则发送不了
- UserAuthenticator userAuthenticator = new UserAuthenticator("wyxz126@sina.com", "i5v2y6");
- Session session = Session.getInstance(props, userAuthenticator);
- session.setDebug(true);
- try {
- // create a message
- MimeMessage msg = new MimeMessage(session);
- msg.setFrom(new InternetAddress("wyxz126@sina.com"));
- InternetAddress[] address = {new InternetAddress(addressurl)};
- msg.setRecipients(Message.RecipientType.TO, address);
- msg.setSubject("会员注册成功 - ITeye做最棒的软件开发交流社区");
- msg.setSentDate(new Date());
-
-
- DataHandler data = new DataHandler(msgTextBuffer.toString(),"text/html;charset=gb2

Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。