вот часть кода, которую я использую:
Код: Выделить всё
//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;
}
Код: Выделить всё
535 5.7.3 Authentication unsuccessful [SI2P153CA0005.APCP153.PROD.OUTLOOK.COM 2025-12-04T14:15:45.148Z 08DE31ECD6048A52]
затем я иду в чатGPT.. и он сказал (ядро):
Код: Выделить всё
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 о MS oAuth
Я забеспокоился, и, подумав, я спросил Google Gemini, и он сказал (ядро):
Код: Выделить всё
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
и если это поможет, мой токен доступа как доступ к следующим областям:
Код: Выделить всё
"openid",
"profile",
"User.Read",
"email",
"offline_access",
"Mail.ReadWrite",
"Mail.Send",
"SMTP.Send",
"MailboxSettings.ReadWrite",
"Files.ReadWrite",
С уважением
Подробнее здесь: https://stackoverflow.com/questions/798 ... onal-email
Мобильная версия