aboutsummaryrefslogtreecommitdiffhomepage
path: root/bin/mail/deliver.sh
diff options
context:
space:
mode:
Diffstat (limited to 'bin/mail/deliver.sh')
-rwxr-xr-xbin/mail/deliver.sh40
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
6epoch=$(date +%s) 7epoch=$(date +%s)
7mail_date="$(date --rfc-email -d @${epoch})" 8mail_date="$(date --rfc-email -d @${epoch})"
@@ -106,45 +107,54 @@ done <<<"$header"
106# decide mailbox by vars {{{ 107# decide mailbox by vars {{{
107if [[ "$SENDER" = pham@topo.tw && -n $CHAT_VERSION ]]; then 108if [[ "$SENDER" = pham@topo.tw && -n $CHAT_VERSION ]]; then
108 private_message 109 private_message
110elif [[ "${FROM}" =~ riverbien ]]; then
111 mailbox=river
112elif [[ "${FROM}" =~ MAILER-DAEMON|accounts ]]; then
113 mailbox=
114elif [[ "${FROM}" =~ taiwandreamer|imtaiwanese18741130|recall ]]; then
115 mailbox=recall
109elif [[ "${TO}" =~ '+'|'=' ]]; then 116elif [[ "${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
112elif [[ "${FROM}${RETURN_PATH}" =~ notifications@github.com|noreply@github.com ]]; then 119elif [[ "${FROM}${RETURN_PATH}" =~ notifications@github.com|noreply@github.com ]]; then
113 mailbox=DEV/github 120 mailbox=zd/github
114elif [[ "${FROM}" =~ jgbsmart.com ]]; then 121elif [[ "${FROM}" =~ jgbsmart.com ]]; then
115 mailbox=rent 122 mailbox=rent
116elif [[ "${SUBJECT}" =~ 帳單|轉帳|對帳|付款|發票|消費|繳費|收據|費用|Invoice|Billing ]]; then 123elif [[ "${SUBJECT}" =~ 帳單|轉帳|對帳|付款|發票|消費|繳費|收據|費用|簽帳|Invoice|Billing ]]; then
117 mailbox=pay 124 mailbox=pay
118elif [[ "${TO}" =~ dmarc@topo.tw ]]; then 125elif [[ "${TO}" =~ dmarc@topo.tw ]]; then
119 mailbox=DEV/dmarc 126 mailbox=zd/dmarc
120elif [[ "${LIST_ID}" =~ ^'Open Street Map Taiwan' ]]; then 127elif [[ "${LIST_ID}" =~ ^'Open Street Map Taiwan' ]]; then
121 mailbox=FOSS/osm 128 mailbox=FOSS/osm
122elif [[ "${TO}" =~ talk-ja@openstreetmap.org ]]; then 129elif [[ "${TO}" =~ talk-ja@openstreetmap.org ]]; then
123 mailbox=LIST/talk-ja 130 mailbox=zl/talk-ja
124elif [[ "${LIST_ID}" =~ ^~rjarry/aerc-discuss ]]; then 131elif [[ "${LIST_ID}" =~ rjarry/aerc-discuss ]]; then
125 mailbox=LIST/aerc 132 mailbox=zl/aerc
126elif [[ "${LIST_ID}" =~ mutt-users.mutt.org ]]; then 133elif [[ "${LIST_ID}" =~ mutt-users.mutt.org ]]; then
127 mailbox=LIST/mutt 134 mailbox=zl/mutt
135elif [[ "${RECEIVED}" =~ lists.archlinux.org ]]; then
136 mailbox=zl/arch
128elif [[ "${SUBJECT}" =~ 啟用 ]]; then 137elif [[ "${SUBJECT}" =~ 啟用 ]]; then
129 mailbox=service 138 mailbox=service
130elif [[ 139elif [[
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
135elif [[ "${SUBJECT}" =~ 密碼|安全性警示|登入|存取|驗證|login|verify|sign-in ]]; then 144elif [[ "${SUBJECT}" =~ 密碼|安全性警示|登入|存取|驗證|確認|login|verif|sign-in ]]; then
136 mailbox=login 145 mailbox=login
137elif [[ "${TO}" = cloudflare@topo.tw ]]; then 146elif [[ "${TO}" = cloudflare@topo.tw ]]; then
138 mailbox=SRV/cloudflare 147 mailbox=SRV/cloudflare
139elif [[ 148elif [[
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
144elif [[ 154elif [[
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
150fi 160fi