From 07124b3dd61dea5873e467a872700d54c304283a Mon Sep 17 00:00:00 2001 From: DIYgod Date: Fri, 23 Aug 2019 18:53:11 +0800 Subject: [PATCH] fix: config of mail route --- docs/en/install/README.md | 2 +- docs/install/README.md | 2 +- docs/other.md | 2 +- lib/config.js | 2 +- lib/routes/mail/imap.js | 4 ++-- 5 files changed, 6 insertions(+), 6 deletions(-) diff --git a/docs/en/install/README.md b/docs/en/install/README.md index 50c88d74f..c3eab9f5c 100644 --- a/docs/en/install/README.md +++ b/docs/en/install/README.md @@ -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 diff --git a/docs/install/README.md b/docs/install/README.md index 1779ecd7e..b4bfe5471 100644 --- a/docs/install/README.md +++ b/docs/install/README.md @@ -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`。 diff --git a/docs/other.md b/docs/other.md index 1be48f602..a003c84b6 100644 --- a/docs/other.md +++ b/docs/other.md @@ -1193,7 +1193,7 @@ type 为 all 时,category 参数不支持 cost 和 free > 仅支持 IMAP 协议 - + ## 语雀 diff --git a/lib/config.js b/lib/config.js index 499ae98d3..3dfe6c67d 100644 --- a/lib/config.js +++ b/lib/config.js @@ -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]; } } diff --git a/lib/routes/mail/imap.js b/lib/routes/mail/imap.js index f32757996..62a6a545c 100644 --- a/lib/routes/mail/imap.js +++ b/lib/routes/mail/imap.js @@ -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})`, };