Java实现发送邮件
1、发送QQ邮件 1 import java.util.Properties; 2 import javax.mail.Message; 3 import javax.mail.MessagingException; 4 import javax.mail.Session; 5 import javax.mail.Transport; 6 import javax.mail.internet.AddressException; 7 import javax.mail.internet.InternetAddress; 8 import javax.mail.internet.MimeMessage; 9 10 public class SendQQMailUtil { 11 12 public static void main(String[] args) throws AddressException,MessagingException { 13 Properties properties = new Properties(); 14 properties.put("mail.transport.protocol", "smtp"); // 连接协议 15 properties.put("mail.smtp.host", "smtp.qq.com"); // 主机名 16