Feat: add IMAP data source integration with configuration and sync capabilities (#12316)

### What problem does this PR solve?
issue:
#12217 [#12313](https://github.com/infiniflow/ragflow/issues/12313)
change:
add IMAP data source integration with configuration and sync
capabilities

### Type of change

- [x] New Feature (non-breaking change which adds functionality)
This commit is contained in:
buua436
2025-12-30 17:09:13 +08:00
committed by GitHub
parent 109e782493
commit bffdb5fb11
11 changed files with 906 additions and 16 deletions

View File

@ -0,0 +1,7 @@
<svg stroke="currentColor" fill="none" stroke-width="2" viewBox="0 0 24 24"
stroke-linecap="round" stroke-linejoin="round"
class="text-text-04" height="32" width="32"
xmlns="http://www.w3.org/2000/svg">
<path d="M4 4h16c1.1 0 2 .9 2 2v12c0 1.1-.9 2-2 2H4c-1.1 0-2-.9-2-2V6c0-1.1.9-2 2-2z"></path>
<polyline points="22,6 12,13 2,6"></polyline>
</svg>

After

Width:  |  Height:  |  Size: 360 B

View File

@ -939,6 +939,8 @@ Example: Virtual Hosted Style`,
'Connect GitLab to sync repositories, issues, merge requests, and related documentation.',
asanaDescription:
'Connect to Asana and synchronize files from a specified workspace.',
imapDescription:
'Connect to your IMAP mailbox to sync emails for knowledge retrieval.',
dropboxAccessTokenTip:
'Generate a long-lived access token in the Dropbox App Console with files.metadata.read, files.content.read, and sharing.read scopes.',
moodleDescription:

View File

@ -755,6 +755,8 @@ export default {
'Подключите GitLab для синхронизации репозиториев, задач, merge requests и связанной документации.',
asanaDescription:
'Подключите Asana и синхронизируйте файлы из рабочего пространства.',
imapDescription:
'Подключите почтовый ящик IMAP для синхронизации писем из указанных почтовых ящиков (mailboxes) с целью поиска и анализа знаний.',
google_driveDescription:
'Подключите ваш Google Drive через OAuth и синхронизируйте определенные папки или диски.',
gmailDescription:

View File

@ -867,6 +867,8 @@ General实体和关系提取提示来自 GitHub - microsoft/graphrag基于
gitlabDescription:
'连接 GitLab同步仓库、Issue、合并请求MR及相关文档内容。',
asanaDescription: '连接 Asana同步工作区中的文件。',
imapDescription:
'连接你的 IMAP 邮箱同步指定mailboxes中的邮件用于知识检索与分析',
r2Description: '连接你的 Cloudflare R2 存储桶以导入和同步文件。',
dropboxAccessTokenTip:
'请在 Dropbox App Console 生成 Access Token并勾选 files.metadata.read、files.content.read、sharing.read 等必要权限。',

View File

@ -27,6 +27,7 @@ export enum DataSourceKey {
AIRTABLE = 'airtable',
GITLAB = 'gitlab',
ASANA = 'asana',
IMAP = 'imap',
GITHUB = 'github',
// SHAREPOINT = 'sharepoint',
// SLACK = 'slack',
@ -127,6 +128,11 @@ export const generateDataSourceInfo = (t: TFunction) => {
description: t(`setting.${DataSourceKey.GITHUB}Description`),
icon: <SvgIcon name={'data-source/github'} width={38} />,
},
[DataSourceKey.IMAP]: {
name: 'IMAP',
description: t(`setting.${DataSourceKey.IMAP}Description`),
icon: <SvgIcon name={'data-source/imap'} width={38} />,
},
};
};
@ -654,7 +660,7 @@ export const DataSourceFormFields = {
{
label: 'Access Token',
name: 'config.credentials.airtable_access_token',
type: FormFieldType.Text,
type: FormFieldType.Password,
required: true,
},
{
@ -722,7 +728,7 @@ export const DataSourceFormFields = {
{
label: 'API Token',
name: 'config.credentials.asana_api_token_secret',
type: FormFieldType.Text,
type: FormFieldType.Password,
required: true,
},
{
@ -778,6 +784,44 @@ export const DataSourceFormFields = {
defaultValue: false,
},
],
[DataSourceKey.IMAP]: [
{
label: 'Username',
name: 'config.credentials.imap_username',
type: FormFieldType.Text,
required: true,
},
{
label: 'Password',
name: 'config.credentials.imap_password',
type: FormFieldType.Password,
required: true,
},
{
label: 'Host',
name: 'config.imap_host',
type: FormFieldType.Text,
required: true,
},
{
label: 'Port',
name: 'config.imap_port',
type: FormFieldType.Number,
required: true,
},
{
label: 'Mailboxes',
name: 'config.imap_mailbox',
type: FormFieldType.Tag,
required: false,
},
{
label: 'Poll Range',
name: 'config.poll_range',
type: FormFieldType.Number,
required: false,
},
],
};
export const DataSourceFormDefaultValues = {
@ -1017,4 +1061,19 @@ export const DataSourceFormDefaultValues = {
},
},
},
[DataSourceKey.IMAP]: {
name: '',
source: DataSourceKey.IMAP,
config: {
name: '',
imap_host: '',
imap_port: 993,
imap_mailbox: [],
poll_range: 30,
credentials: {
imap_username: '',
imap_password: '',
},
},
},
};