超级终端工具-无法删除桌面图标
2023年4月6日发(作者:epic双重认证)
Java对接⾕歌邮箱-代码及其⾕歌邮箱账号配置
⾸先登录Gmail账号
找到这个地⽅
然后查看所有配置
然后贴代码:
privatestaticStringfrom="youAccount@";//发送者的⾕歌邮箱
privatestaticStringpassword="password";//⾕歌邮箱密码
publicstaticbooleansendMailGMail(Stringto,Stringcontent){
returngmailSender(from,password,to,"标题",content);
}
privatestaticvoidgmailSsl(Propertiesprops){
finalStringSSL_FACTORY="ketFactory";
("","true");
("","");
("","true");
("",SSL_FACTORY);
("","465");
//("","587");
("","465");
//("","587");
("","true");
}
publicstaticbooleangmailSender(Stringfrom,Stringpassword,Stringemail,Stringsubject,Stringcontent){
Propertiesprops=newProperties();
gmailSsl(props);
Sessionsession=aultInstance(props,
newAuthenticator(){
protectedPasswordAuthenticationgetPasswordAuthentication(){
returnnewPasswordAuthentication(from,password);
}
});
Messagemsg=newMimeMessage(session);
try{
m(newInternetAddress(from));
ipients(,
(email));
ject(subject);
t(content);
tDate(newDate());
(msg);
}catch(AddressExceptione){
tackTrace();
}catch(MessagingExceptione){
tackTrace();
}
returntrue;
}
到此别以为就能发送了哈哈哈我也是这么认为,但是还发送不了提⽰了
那这个时候就需要修改⼀下⾕歌账号配置了:
⾄此,点击发送就能发送啦
踩坑不易,点个赞吧~
更多推荐
gmail邮箱登录
发布评论