项目

一般

简介

插件 » Redmine Email Fetcher 把邮件提取到Redmine(Redmine 4.*兼容版)

Redmine Email Fetcher

发布于: https://github.com/luismaia/redmine_email_fetcher
兼容于: Redmine 4.1.*, 4.0.*, 3.4.*, 3.3.*, 3.2.*, 3.1.*, 3.0.*, 2.6.*, 2.5.*, 2.4.*, 2.3.*, 2.2.*, 2.1.*

最新版本: 0.3.1 更新日期: 2023-03-16 14:54

安装指导

插件安装

  • 解压并拷贝整个插件目录到Redmine的plugins目录下。 确保插件目录名为redmine_email_fetcher。
  • 在redmine的目录下执行如下命令,完成插件必要的gems安装和插件数据库迁移
    bundle install
    RAILS_ENV=production bundle exec rake redmine:plugins:migrate
    
  • 重新启动Redmine

如果插件安装成功,在Redmine的 管理→插件 里可以看到所列出的 Redmine Email Fetcher插件。同时在管理界面中新增Fetch emails子菜单,用于邮件提取的详细参数设置。

插件安装后为Redmine新增一个task,指令如下

rake -T redmine:plugins:email_fetcher RAILS_ENV=production

插件卸载

  • 在Redmine目录下执行
    RAILS_ENV=production rake redmine:plugins:migrate NAME=redmine_email_fetcher VERSION=0
    
  • 删除插件文件夹
  • 重新启动redmine

配置方法

  • 邮件配置属性
    • Configuration type 邮件账户配置类型
      • IMAP
      • POP3
    • Is configuration active? 定义邮件账户是否激活或是否应该同步
      • True ,Task fetch_all_emails 表示任务该同步所有邮件
      • False,Task fetch_all_emails 表示忽略邮件
      • Last successful fetch at (只读)显示最后一次邮件同步到redmine的时间
  • Email Attributes 邮件属性
    • Host - The IMAP or POP3 server host (e.g. 127.0.0.1).
    • Port - The IMAP or POP3 server port. Eg., 993.
    • SSL - SSL usage? (Default: True) [Options: True, False]
    • Username - The IMAP or POP3 email account username (e.g. ).
    • Password - The IMAP or POP3 email account password.
    • Folder name - The email folder name from where the emails should be fetched:
      • IMAP - Any folder name is possible, but the test function will validate that this folder is reachable after login) (e.g. REDMINE).
      • POP3 - Since this is an old protocol, only the INBOX folder is allowed (in fact you can’t change this option)
      • On success move to folder (IMAP only) - (optional) This IMAP attribute allows configuration of where successfully received emails should be moved to, instead of deleting them (e.g. ARCHIVE).
      • On failure move to folder (IMAP only) - (optional) This IMAP attribute allows configuration of where ignored emails should be moved (e.g. IGNORED).
      • Use APOP? (POP3 only) - This POP3 attribute allows specifying if APOP authentication should be used (default: false).
      • On failure delete email (POP3 only) - This POP3 attribute allows specifying whether emails which could not be processed successfully are deleted from the server
        (default: false - default behaviour is to leave them on the server).
  • Unknown Sender Actions (in Redmine):
    • Method for unknown users - How to handle emails from an unknown user where ACTION can be one of the following values:
      • accept - the sender is considered as an anonymous user and the email is accepted (default). If you choose this option you must activate the Custom field owner-email, where the sender email address will be stored. Without this field activated, the email fetch will fail, since this information is required to send information back to the sender (the Redmine Helpdesk plugin may be a nice addition).
      • ignore - The email is ignored.
      • create - A user account is created for the sender (username/password are sent back to the user) and the email is accepted.
    • Use no_account_notice - Suppressing account generation notification (default False).
    • Use no_permission_check - Disable permission checking when receiving the email (default True).
    • Default group for new reporters - (optional) Automatically adding new users to some group(s) (e.g. group1,group2).
  • Default Issue creation (in Redmine) Attributes:
    • Tracker - Target tracker (in case no tracker is specified in email content).
    • Category name - (optional) Name of the default category (in case no category is specified in email content).
    • Priority name - (optional) Name of the default priority (in case no priority is specified in email content).
    • allow_override - (optional) Allow email content to override attributes specified by previous options ATTRS is a comma separated list of attributes (e.g. project,tracker,category,priority).
    • Project - Target default project (in case no project is specified in email content).

更多参数详细解释请参考Redmine官方wiki页面 RedmineReceivingEmails

利用Rake tasks制定计划任务

  • Redmine Email Fetcher的有效任务:
    # rake -T redmine:plugins:email_fetcher
    rake redmine:plugins:email_fetcher:fetch_all_emails   # Fetch all active email accounts emails to Redmine
    
  • This task can be used for periodic synchronization. For example:
    # fetch all active email accounts emails to Redmine @ every 5 minutes
    */5 * * * *   www-data /usr/bin/rake -f /opt/redmine/Rakefile --silent redmine:plugins:email_fetcher:fetch_all_emails RAILS_ENV=production 2>&- 1>&-
    
  • The tasks recognize three environment variables:
    • DRY_RUN - Performs a run without changing the database.
    • LOG_LEVEL - Controls the rake task verbosity. The possible values are:
      • silent: Nothing is written to the output.
      • error: Only errors are written to the output.
      • change: Only writes errors and changes made to the user/group’s base.
      • debug: Detailed information about the execution is visible to help identify errors. This is the default value.