diff options
Diffstat (limited to 'bin/mail/deliver.sh')
-rwxr-xr-x | bin/mail/deliver.sh | 40 |
1 files changed, 25 insertions, 15 deletions
diff --git a/bin/mail/deliver.sh b/bin/mail/deliver.sh index d101602..52c5d01 100755 --- a/bin/mail/deliver.sh +++ b/bin/mail/deliver.sh | |||
@@ -2,6 +2,7 @@ | |||
2 | 2 | ||
3 | # Deliver incoming mail to proper mailbox | 3 | # Deliver incoming mail to proper mailbox |
4 | # TODO image/audio mail part | 4 | # TODO image/audio mail part |
5 | # TODO CJK Subject in index/pager mode: tofo or backslash | ||
5 | 6 | ||
6 | epoch=$(date +%s) | 7 | epoch=$(date +%s) |
7 | mail_date="$(date --rfc-email -d @${epoch})" | 8 | mail_date="$(date --rfc-email -d @${epoch})" |
@@ -106,45 +107,54 @@ done <<<"$header" | |||
106 | # decide mailbox by vars {{{ | 107 | # decide mailbox by vars {{{ |
107 | if [[ "$SENDER" = pham@topo.tw && -n $CHAT_VERSION ]]; then | 108 | if [[ "$SENDER" = pham@topo.tw && -n $CHAT_VERSION ]]; then |
108 | private_message | 109 | private_message |
110 | elif [[ "${FROM}" =~ riverbien ]]; then | ||
111 | mailbox=river | ||
112 | elif [[ "${FROM}" =~ MAILER-DAEMON|accounts ]]; then | ||
113 | mailbox= | ||
114 | elif [[ "${FROM}" =~ taiwandreamer|imtaiwanese18741130|recall ]]; then | ||
115 | mailbox=recall | ||
109 | elif [[ "${TO}" =~ '+'|'=' ]]; then | 116 | elif [[ "${TO}" =~ '+'|'=' ]]; then |
110 | mailbox=${TO#*[+=]} # remove chars before symbol of mailbox | 117 | mailbox=${TO#*[+=]} # remove chars before symbol of mailbox |
111 | mailbox=${mailbox%@*} # remove suffix for mail address | 118 | mailbox=${mailbox%@*} # remove suffix for mail address |
112 | elif [[ "${FROM}${RETURN_PATH}" =~ notifications@github.com|noreply@github.com ]]; then | 119 | elif [[ "${FROM}${RETURN_PATH}" =~ notifications@github.com|noreply@github.com ]]; then |
113 | mailbox=DEV/github | 120 | mailbox=zd/github |
114 | elif [[ "${FROM}" =~ jgbsmart.com ]]; then | 121 | elif [[ "${FROM}" =~ jgbsmart.com ]]; then |
115 | mailbox=rent | 122 | mailbox=rent |
116 | elif [[ "${SUBJECT}" =~ 帳單|轉帳|對帳|付款|發票|消費|繳費|收據|費用|Invoice|Billing ]]; then | 123 | elif [[ "${SUBJECT}" =~ 帳單|轉帳|對帳|付款|發票|消費|繳費|收據|費用|簽帳|Invoice|Billing ]]; then |
117 | mailbox=pay | 124 | mailbox=pay |
118 | elif [[ "${TO}" =~ dmarc@topo.tw ]]; then | 125 | elif [[ "${TO}" =~ dmarc@topo.tw ]]; then |
119 | mailbox=DEV/dmarc | 126 | mailbox=zd/dmarc |
120 | elif [[ "${LIST_ID}" =~ ^'Open Street Map Taiwan' ]]; then | 127 | elif [[ "${LIST_ID}" =~ ^'Open Street Map Taiwan' ]]; then |
121 | mailbox=FOSS/osm | 128 | mailbox=FOSS/osm |
122 | elif [[ "${TO}" =~ talk-ja@openstreetmap.org ]]; then | 129 | elif [[ "${TO}" =~ talk-ja@openstreetmap.org ]]; then |
123 | mailbox=LIST/talk-ja | 130 | mailbox=zl/talk-ja |
124 | elif [[ "${LIST_ID}" =~ ^~rjarry/aerc-discuss ]]; then | 131 | elif [[ "${LIST_ID}" =~ rjarry/aerc-discuss ]]; then |
125 | mailbox=LIST/aerc | 132 | mailbox=zl/aerc |
126 | elif [[ "${LIST_ID}" =~ mutt-users.mutt.org ]]; then | 133 | elif [[ "${LIST_ID}" =~ mutt-users.mutt.org ]]; then |
127 | mailbox=LIST/mutt | 134 | mailbox=zl/mutt |
135 | elif [[ "${RECEIVED}" =~ lists.archlinux.org ]]; then | ||
136 | mailbox=zl/arch | ||
128 | elif [[ "${SUBJECT}" =~ 啟用 ]]; then | 137 | elif [[ "${SUBJECT}" =~ 啟用 ]]; then |
129 | mailbox=service | 138 | mailbox=service |
130 | elif [[ | 139 | elif [[ |
131 | "${SUBJECT}" =~ 電子報|快訊|newsletter || | 140 | "${SUBJECT}" =~ 電子報|快訊|newsletter || |
132 | "${FROM}${TO}" =~ substack|service@kucw.io \ | 141 | "${FROM}${TO}" =~ substack|service@kucw.io|linuxhandbook |
133 | ]]; then | 142 | ]]; then |
134 | mailbox=news | 143 | mailbox=news |
135 | elif [[ "${SUBJECT}" =~ 密碼|安全性警示|登入|存取|驗證|login|verify|sign-in ]]; then | 144 | elif [[ "${SUBJECT}" =~ 密碼|安全性警示|登入|存取|驗證|確認|login|verif|sign-in ]]; then |
136 | mailbox=login | 145 | mailbox=login |
137 | elif [[ "${TO}" = cloudflare@topo.tw ]]; then | 146 | elif [[ "${TO}" = cloudflare@topo.tw ]]; then |
138 | mailbox=SRV/cloudflare | 147 | mailbox=SRV/cloudflare |
139 | elif [[ | 148 | elif [[ |
140 | "${SUBJECT}" =~ 通知|提及|未讀|更新|核對|嘟文|unread|summary|mention|introduc || | 149 | "${SUBJECT}" =~ 通知|提及|未讀|更新|核對|嘟文|unread|summary|mention|introduc || |
141 | "${FROM}" =~ notification[s]?@|no-reply@hackmd.io \ | 150 | "${FROM}" =~ iservice@narlabs.org.tw || |
151 | "${FROM}" =~ notification[s]?@|no-reply@hackmd.io | ||
142 | ]]; then | 152 | ]]; then |
143 | mailbox=update | 153 | mailbox=update |
144 | elif [[ | 154 | elif [[ |
145 | "${SUBJECT}${FROM}" =~ 優惠|快訊|願望清單|期待|活動|eDM || | 155 | "${SUBJECT}${FROM}" =~ 優惠|快訊|願望清單|期待|活動|eDM|invitation || |
146 | -n "${LIST_ID}${LIST_UNSUBSCRIBE}" || | 156 | ${FROM} =~ cora.computer|noreply@steampowered.com || |
147 | ${TO} =~ tienling.chou@topo.tw \ | 157 | -n "${LIST_ID}${LIST_UNSUBSCRIBE}${FEEDBACK_ID}${THREAD_INDEX}${X_MAILGUN_TAG}${X_SFMC_STACK}" |
148 | ]]; then | 158 | ]]; then |
149 | mailbox=promote | 159 | mailbox=promote |
150 | fi | 160 | fi |