package cn.itcast.bos.utils;
import java.util.Properties;
import javax.mail.Message;
import javax.mail.Session;
import javax.mail.Transport;
import javax.mail.internet.InternetAddress;
import javax.mail.internet.MimeMessage;
import javax.mail.internet.MimeMessage.RecipientType;
public class MailUtils {
private static String smtp_host = “smtp.163.com”;
private static String username = “itcast_search@163.com”;
private static String password = “itcast123”;
private static String from = “itcast_search@163.com”;
private static String activeUrl = “”;
public static void sendMail(String subject, String content, String to,
String activecode) {
Properties props = new Properties();
props.setProperty(“mail.smtp.host”, smtp_host);
props.setProperty(“mail.transport.protocol”, “smtp”);
props.setProperty(“mail.smtp.auth”, “true”);
Session session = Session.getInstance(props);
Message message = new MimeMessage(session);
try {
message.setFrom(new InternetAddress(from));
message.setRecipient(RecipientType.TO, new InternetAddress(to));
message.setSubject(subject);
message.setContent(“