需要提供你在163上面的用户名和密码
如果不需要这些的话,不是可以随便匿名发送垃圾邮件了么?
希望下面的代码有帮助
String message = "content";
Properties props = new Properties();
Session sendMailSession;
Transport transport;
sendMailSession = Session.getInstance(props, null);
sendMailSession.setDebug(true);
props.put("mail.smtp.host", "smtp.163.com");
Message newMessage = new MimeMessage(sendMailSession);
newMessage.setFrom(new InternetAddress("
xxxxx@163.com"));
newMessage.setRecipient(Message.RecipientType.TO, new InternetAddress("
xxxxx@163.com"));
newMessage.setSubject("申请服务");
newMessage.setSentDate(new Date());
MimeBodyPart mbp = new MimeBodyPart();
mbp.setText(message);
MimeMultipart mmp = new MimeMultipart();
mmp.addBodyPart(mbp);
newMessage.setContent(mmp);
Transport.send(newMessage);