Java测试发送邮件的时候经常出现异常,检查多次账户名密码无误后,依然出现如下图错误: 之前不清楚,后面在网上得到提醒,我们所使用的smtp服务器使用的密码与我们自身登录网页端邮箱的密码是不一样的,以163邮箱为例,当我们设置打开smtp服务时会要求我们设
下载地址:
下载1 封装好的java邮件包,代码调用示例 public static void main(String[] args) throws Exception {
FinderSendMail sendMail;
MailInfo mailInfo =new MailInfo();
mailInfo.setTitle("test title");
mailInfo.setFrom("xxx@163.com");
mailInfo.setHost("smtp.163.com");
mailInfo.setTo("xxx@gmail.com");
mailInfo.setUsername("xxx@163.com");
mailInfo.setPassword("xxx");
//mailInfo.setContentType("text/html");
mailInfo.setContent("welcome to 技术社区");
sendMail=new FinderSendMail(mailInfo);
sendMail.send();
} 就这么简单调用,就