| | |
| | | props.put("mail.smtp.port", "587"); |
| | | } |
| | | |
| | | public static void main(String[] args) throws Exception { |
| | | send("liuarchy32@gmail.com", "测试", "测试"); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 创建邮件内容 |
| | | * |
| | |
| | | Properties props = new Properties(); |
| | | //选择ssl方式 |
| | | gmailssl(props); |
| | | // qqmailtls(props); |
| | | |
| | | final String displayName = "I-GO";//昵称 |
| | | final String username = "i-gotech@i-go.group";// gmail 邮箱 |
| | | final String password = "wpwfkrlvridoayyh";// Google应用专用密码 |
| | | final String username = "noreply@i-go.group";// gmail 邮箱 |
| | | final String password = "fggipafjlcqxjmef";// Google应用专用密码 |
| | | // final String username = "1019712155@qq.com";// qq 邮箱 |
| | | // final String password = "ctuaexczdrembcfd";// 授权码 |
| | | Session session = Session.getInstance(props, |
| | | new Authenticator() { |
| | | protected PasswordAuthentication getPasswordAuthentication() { |
| | |
| | | props.put("mail.smtp.auth", "true"); |
| | | } |
| | | |
| | | private static void qqmailtls(Properties props) { |
| | | props.put("mail.smtp.auth", "true"); |
| | | props.put("mail.smtp.starttls.enable", "true"); |
| | | props.put("mail.smtp.host", "smtp.qq.com"); |
| | | props.put("mail.smtp.port", "587"); |
| | | } |
| | | |
| | | public static String getWeek(int language, int i) { |
| | | String week = ""; |
| | | if (language == 1) { |