hier ist der Teil des Codes, den ich verwende:
Code: Select all
//preparing Mail Object
Chilkat.MailMan mail = new Chilkat.MailMan()
{
SmtpHost = "smtp.office365.com",
SmtpPort = 587,
StartTLS = true,
SmtpUsername = sysConfig.Client.Email,
OAuth2AccessToken = token,
};
//opening smtp connection
bool bPass = mail.SmtpConnect();
if(bPass == false)
{
return false;
}
//authenticate smtp
bPass = mail.SmtpAuthenticate(); //it's fails here
if(bPass == false)
{
return false;
}
Code: Select all
535 5.7.3 Authentication unsuccessful [SI2P153CA0005.APCP153.PROD.OUTLOOK.COM 2025-12-04T14:15:45.148Z 08DE31ECD6048A52]
Code: Select all
Your code is correct for OAuth2, but Outlook/Hotmail SMTP (smtp.office365.com) NO LONGER accepts OAuth2 tokens for personal Hotmail/Outlook.com accounts.
Chat-GPT-Antwort über MS oAuth
Ich mache mir Sorgen, und bei einem zweiten Gedanken fragte ich Google Gemini, und er sagte (der Kern):
Code: Select all
It is not true that Microsoft personal accounts (e.g., Outlook.com, Hotmail.com) do not support SMTP OAuth. In fact, Microsoft is phasing out basic authentication (username and password) for security reasons and requires the use of OAuth 2.0 (Modern Authentication) for applications connecting via SMTP
Und wenn das hilft, mein Zugriffstoken als Zugriff auf folgende Bereiche:
Code: Select all
"openid",
"profile",
"User.Read",
"email",
"offline_access",
"Mail.ReadWrite",
"Mail.Send",
"SMTP.Send",
"MailboxSettings.ReadWrite",
"Files.ReadWrite",
Mit freundlichen Grüßen
Mobile version