小编asp*_*nty的帖子

535 5.7.139 身份验证失败,租户禁用 SmtpClientAuthentication

我使用 SMTP 发送电子邮件时出现错误。我的身份验证失败。用户名和密码正确。难道我做错了什么。

public class Office365TextMsgSend {

Properties properties;
Session session;
MimeMessage mimeMessage;

String USERNAME = "xxxx@xxxx.xx";
String PASSWORD = "xxxxxxx";
String HOSTNAME = "smtp.office365.com";
String STARTTLS_PORT = "587";
boolean STARTTLS = true;
boolean AUTH = true;
String FromAddress="xxxx@xxxx.xx";

public static void main(String args[]) throws MessagingException {
    String EmailSubject = "Subject:Text Subject";
    String EmailBody = "Text Message Body: Hello World";
    String ToAddress = "xxxxxx@gmail.com";
    Office365TextMsgSend office365TextMsgSend = new Office365TextMsgSend();
    office365TextMsgSend.sendGmail(EmailSubject, EmailBody, ToAddress);
}

public void sendGmail(String EmailSubject, String EmailBody, String …
Run Code Online (Sandbox Code Playgroud)

java outlook exchange-server office365

4
推荐指数
1
解决办法
7万
查看次数

标签 统计

exchange-server ×1

java ×1

office365 ×1

outlook ×1