使用gmail用javamail发送邮件

  • Post author:
  • Post category:java


package practical;

import java.security.Security;

import java.util.Properties;

import javax.mail.Message;

import javax.mail.MessagingException;

import javax.mail.PasswordAuthentication;

import javax.mail.Session;

import javax.mail.Transport;

import javax.mail.internet.InternetAddress;

import javax.mail.internet.MimeMessage;

public class GoogleTest {

private static final String SMTP_HOST_NAME = “smtp.gmail.com”;

private static final String SMTP_PORT = “465”;

private static final String emailMsgTxt = “Test Message Contents”;

private static final String emailSubjectTxt = “A test from gmail”;

private static final String emailFromAddress = “something@gmail.com”;

private static final String SSL_FACTORY = “javax.net.ssl.SSLSocketFactory”;

private static final String[] sendTo = {“someone@gmail.com”



版权声明:本文为kindy1022原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。