子地址的 Mailhandler 前端¶
此頁面是為早期版本的 Redmine 編寫的。在 Redmine 3.2 和更新版本中,您可以使用 rdm-mailhandler.rb 的「--project-from-subaddress」選項啟用子地址 (#20732)。請參閱接收電子郵件。
使用 rdm-mailhandler.rb 時,一個非常有用的功能是使用單一電子郵件地址來啟用多個專案,而無需每次都在電子郵件正文中覆寫專案。這可以使用以下 RFC 中定義的子地址格式來實現
運作方式¶
子地址使用「+」號與真實地址分隔,例如,電子郵件
<redmine@example.com>
將變成
<redmine+project@example.com>
相容的 MTA 仍會將這些電子郵件發送到 <redmine@example.com> 收件者,並且由該收件者自行決定如何使用子地址部分。
sub-mailhandler.py 腳本是 rdm-mailhandler.rb 的前端,它會讀取電子郵件的標頭,尋找子地址,然後使用指定的專案或預設專案(如果有的話)啟動 rdm-mailhandler.rb。它可以按字面意義「插入」到命令列的前面。
用法¶
Usage: sub-mailhandler.py -h | -e <email> [ -p <project> ] -- <command-line> The <command-line> portion is the full rdm-mailhandler.rb command that would normally be executed as the mail handler. The full path to the executable is required. This command should not include a project; use the build-in --project argument instead. Options: -h, --help show this help message and exit -e EMAIL, --email=EMAIL Known email to look for (i.e. redmine recipient) -p PROJECT, --project=PROJECT Default project to pass to rdm-mailhandler.rb if there is no subaddress
範例¶
假設您有這個 .forward 檔案
"|/home/redmine/rdm-mailhandler.rb --url http://redmine.example.com --project myproject --allow-override project,tracker,category,priority,status --key xxxxxxxxxxxxxxx"
您始終必須提供收件者電子郵件,在這種情況下,您必須將預設專案參數移至 sub-mailhandler.py。其他所有內容都逐字複製
"|/home/redmine/sub-mailhandler.py --email redmine@example.com --project myproject -- /home/redmine/rdm-mailhandler.rb --url http://redmine.example.com --allow-override project,tracker,category,priority,status --key xxxxxxxxxxxxxxx"
現在,您仍然可以將電子郵件發送到 <redmine@example.com> 並使用預設專案(並覆寫它)。但是,如果您想為「projectx」發送電子郵件,則可以將其發送到 <redmine+projectx@example.com>,並且專案將相應設定。
致謝¶
此腳本和 wiki 頁面最初由 Thomas Guyot-Sionnest <thomas@gmail.com> 編寫