Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature]: 支持 Office365 Oauth2 发送 Email || [Feature]: Support Office365 Oauth2 to send Email #2878

Open
mengguyi opened this issue Dec 24, 2024 · 2 comments
Labels
discussion Question or dicussion enhancement New feature or request

Comments

@mengguyi
Copy link

mengguyi commented Dec 24, 2024

功能概述 | Describe the feature

微软已弃用 Exchange Online 中的基本身份验证 https://learn.microsoft.com/zh-cn/exchange/clients-and-mobile-in-exchange-online/deprecation-of-basic-authentication-exchange-online
现在使用的代码无法使用 Oauth2 来连接 Outlook

const {
SMTP_USER,
SMTP_PASS,
SMTP_HOST,
SMTP_PORT,
SMTP_SECURE,
SMTP_SERVICE,
} = process.env;
if (SMTP_HOST || SMTP_SERVICE) {
const config = {
auth: { user: SMTP_USER, pass: SMTP_PASS },
};
if (SMTP_SERVICE) {
config.service = SMTP_SERVICE;
} else {
config.host = SMTP_HOST;
config.port = parseInt(SMTP_PORT);
config.secure = SMTP_SECURE !== 'false';
}
this.transporter = nodemailer.createTransport(config);
}

这个 issue 中讲述了如何使用 Oatuh2 连接 Outlook 365


Feature Overview | Describe the feature

Microsoft has deprecated Basic Authentication in Exchange Online https://learn.microsoft.com/zh-cn/exchange/clients-and-mobile-in-exchange-online/deprecation-of-basic-authentication-exchange-online
The code I am using now cannot connect to Outlook using Oauth2

const {
SMTP_USER,
SMTP_PASS,
SMTP_HOST,
SMTP_PORT,
SMTP_SECURE,
SMTP_SERVICE,
} = process.env;
if (SMTP_HOST || SMTP_SERVICE) {
const config = {
auth: { user: SMTP_USER, pass: SMTP_PASS },
};
if (SMTP_SERVICE) {
config.service = SMTP_SERVICE;
} else {
config.host = SMTP_HOST;
config.port = parseInt(SMTP_PORT);
config.secure = SMTP_SECURE !== 'false';
}
this.transporter = nodemailer.createTransport(config);
}

This issue describes how to use Oatuh2 to connect to Outlook 365

@mengguyi mengguyi added discussion Question or dicussion enhancement New feature or request labels Dec 24, 2024
@github-actions github-actions bot changed the title [Feature]: 支持 Office365 Oauth2 发送 Email [Feature]: 支持 Office365 Oauth2 发送 Email || [Feature]: Support Office365 Oauth2 to send Email Dec 24, 2024
@hui-shao
Copy link

hui-shao commented Dec 27, 2024

前一阵子研究了一下这个,在本地进行测试,accessToken 获取和刷新比较麻烦,要在 Azure 上配置一堆东西,但最后发送邮件也总是不成功,不知道为啥。

相关参考:https://github.com/jstedfast/MailKit/blob/master/ExchangeOAuth2.md


I studied this a while ago and tested it locally. It is troublesome to obtain and refresh the accessToken. I need to configure a lot of things on Azure, but in the end, sending emails always fails. I don’t know why.

Related reference: https://github.com/jstedfast/MailKit/blob/master/ExchangeOAuth2.md

@mengguyi
Copy link
Author

前一阵子研究了一下这个,在本地进行测试,accessToken 获取和刷新比较麻烦,要在 Azure 上配置一堆东西,但最后发送邮件也总是不成功,不知道为啥。

相关参考:https://github.com/jstedfast/MailKit/blob/master/ExchangeOAuth2.md

I studied this a while ago and tested it locally. It is troublesome to obtain and refresh the accessToken. I need to configure a lot of things on Azure, but in the end, sending emails always fails. I don’t know why.

Related reference: https://github.com/jstedfast/MailKit/blob/master/ExchangeOAuth2.md

我也改了改,但是 accessToken + Oauth2 没法正常发送。感觉不如用 Graph API

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
discussion Question or dicussion enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants