fix: config of mail route

This commit is contained in:
DIYgod 2019-08-23 18:53:11 +08:00
parent 34233f5fd4
commit 07124b3dd6
No known key found for this signature in database
GPG Key ID: EC0B76A252D3EF67
5 changed files with 6 additions and 6 deletions

View File

@ -342,7 +342,7 @@ When adding feeds using RSS readers with HTTP Basic Authentication support, auth
- `mail`:
- `EMAIL_CONFIG_{email}`: Mail setting, replace `{email}` with email account, like `EMAIL_CONFIG_xxx@qq.com`. the value format is `password=password&host=server&port=port`, like `password=123456&host=imap.qq.com&port=993`
- `EMAIL_CONFIG_{email}`: Mail setting, replace `{email}` with email account, replace `@` in email account with `.`, like `EMAIL_CONFIG_xxx.qq.com`. the value format is `password=password&host=server&port=port`, like `password=123456&host=imap.qq.com&port=993`
### Access Control

View File

@ -412,4 +412,4 @@ RSSHub 支持 `memory` 和 `redis` 两种缓存方式
- 邮箱 邮件列表路由:
- `EMAIL_CONFIG_{email}`: 邮箱设置,替换 {email} 为 邮箱账号,例如 `EMAIL_CONFIG_xxx@qq.com`。内容格式为 `password=密码&host=服务器&port=端口`,例如 `password=123456&host=imap.qq.com&port=993`
- `EMAIL_CONFIG_{email}`: 邮箱设置,替换 {email} 为 邮箱账号,邮件账户的 `@` 替换为 `.`,例如 `EMAIL_CONFIG_xxx.qq.com`。内容格式为 `password=密码&host=服务器&port=端口`,例如 `password=123456&host=imap.qq.com&port=993`

View File

@ -1193,7 +1193,7 @@ type 为 all 时category 参数不支持 cost 和 free
> 仅支持 IMAP 协议
<Route author="kt286" example="/mail/imap/xx@qq.com" path="/mail/imap/:email" :paramsDesc="['邮箱账号']" />
<Route author="kt286" example="/mail/imap/rss.rsshub.app" path="/mail/imap/:email" :paramsDesc="['邮箱账号']" />
## 语雀

View File

@ -10,7 +10,7 @@ for (const name in envs) {
const id = name.slice(14);
twitter_tokens[id] = envs[name];
} else if (name.startsWith('EMAIL_CONFIG_')) {
const id = name.slice(13);
const id = name.slice(13).replace('.', '@');
email_config[id] = envs[name];
}
}

View File

@ -19,7 +19,7 @@ module.exports = async (ctx) => {
throw Error('please config email password, host, port in .env file');
}
const imap = new ImapClient(mailConfig.host, mailConfig.port, {
const imap = new ImapClient(mailConfig.host, parseInt(mailConfig.port), {
logLevel: 'error',
auth: {
user: mailConfig.username,
@ -47,7 +47,7 @@ module.exports = async (ctx) => {
const single = {
title: item.envelope.subject,
description: description.html || description.textAsHtml,
guid: item.envelope['message-id'],
guid: item.envelope['message-id'] || item.envelope.date,
pubDate: item.envelope.date,
author: `${item.envelope.from[0].name}(${item.envelope.from[0].address})`,
};