package com.yccrc.kede.test;

import java.util.Properties;

import javax.mail.Session;

import org.springframework.mail.SimpleMailMessage;
import org.springframework.mail.javamail.JavaMailSenderImpl;

import cn.hutool.core.util.ReUtil;

public class MailTest {
	public static void main(String args[]) {
		// 发送器
//		  JavaMailSenderImpl sender = new JavaMailSenderImpl();
//		  sender.setHost("smtp.163.com");
//		  sender.setPort(25); // 默认就是25
//		  sender.setUsername("kedekeyanxitong@163.com"); 
//		  sender.setPassword("QTKZWPDBTNZJWBGG");
//		   
//		  // 配置文件对象   
////		        Properties props = new Properties();    
////		        props.put("mail.smtp.auth", "true"); // 是否进行验证
////		  Session session = Session.getInstance(props);
////		  sender.setSession(session); // 为发送器指定会话
////		   
//		  SimpleMailMessage mail = new SimpleMailMessage();
//		  mail.setTo("46742928@qq.com"); // 发送给谁
//		  mail.setSubject("邀请"); // 标题
//		  mail.setFrom("kedekeyanxitong@163.com"); // 来自
//		  // 邮件内容
//		  mail.setText("明天去钓鱼");
//		   
//		  sender.send(mail); // 发送
//		   
//		  System.out.println("邮件发送成功");
		
		System.out.println(ReUtil.isMatch("^\\s*\\w+(?:\\.{0,1}[\\w-]+)*@[a-zA-Z0-9]+(?:[-.][a-zA-Z0-9]+)*\\.[a-zA-Z]+\\s*$"  ,null));
		System.out.println(ReUtil.isMatch("^\\s*\\w+(?:\\.{0,1}[\\w-]+)*@[a-zA-Z0-9]+(?:[-.][a-zA-Z0-9]+)*\\.[a-zA-Z]+\\s*$"  ,""));
		System.out.println(ReUtil.isMatch("^\\s*\\w+(?:\\.{0,1}[\\w-]+)*@[a-zA-Z0-9]+(?:[-.][a-zA-Z0-9]+)*\\.[a-zA-Z]+\\s*$"  ,"46742928qq.com"));
		System.out.println(ReUtil.isMatch("^\\s*\\w+(?:\\.{0,1}[\\w-]+)*@[a-zA-Z0-9]+(?:[-.][a-zA-Z0-9]+)*\\.[a-zA-Z]+\\s*$"  ,"46742928@qq.com"));
	}
}
