public static void sendMail(String from,String to,String host,String text,String subject){
try{
Properties props = new Properties();
Session sendMailSession;
Store store;
Transport transport;
sendMailSession = Session.getInstance(props, null);
props.put("mail.smtp.host", "邮件服务器");
Message newMessage = new MimeMessage(sendMailSession);
newMessage.setFrom(new InternetAddress(from));
newMessage.setRecipient(Message.RecipientType.TO, new InternetAddress(to));
newMessage.setSubject(subject);
newMessage.setSentDate(new Date());
newMessage.setText(text);
transport = sendMailSession.getTransport("smtp");
transport.send(newMessage);
}catch(MessagingException m){
System.out.println(m.toString());
}
}
dsfsfsfsdf