Dovecot Plugin - mail_log

最後更新: 2019-08-30

 


mail_log

 

Setting: dovecot.conf

# Global
mail_plugins = ... notify mail_log

plugin {
  # Events to log
  # flag_change save mailbox_create
  mail_log_events = delete undelete expunge copy mailbox_delete mailbox_rename

  # Available fields: uid, box, msgid, from, subject, size, vsize, flags
  # size and vsize are available only for expunge and copy events.
  mail_log_fields = box from subject msgid size
}

Notes

 * 要有 "notify" plugin: 令其他 Plugin 知到 mailbox 有所改變

Setting

只針對 imap 及 pop3 做 log (亦即是說 sieve 的操作係 log 唔到)

Setting: 20-imap.conf

protocol imap{
    mail_plugins = $mail_plugins mail_log
}

Setting: 20-pop3.conf

protocol pop3 {
    mail_plugins = $mail_plugins mail_log
}

Log Msg

 * Move mail

# 由 Inbox move 到 testing/test3

... imap(user@domain): Info: copy from INBOX: box=testing.test3, msgid=...
... imap(user@domain): Info: delete: box=INBOX , msgid=...
... imap(user@domain): Info: expunge: box=INBOX, msgid=...

 * Delete mail 時會 log 到的 info. (roundcube)

# 在 INBOX 按 Delete 時
... Info: copy from INBOX: box=INBOX.Trash, ...
... Info: expunge: box=INBOX.Sent, ...
# 在 Trash 按 Delete 時
... Info: delete: box=INBOX.Trash, ...

 * Delete folder 時會 log 到的 info. (roundcube)

... Info: Mailbox deleted: INBOX.test, ...

裡面有的信都會在無 log 的情況下一次過 delete !!

 * POP3

... pop3(user@domain): Info: expunge: box=INBOX, msgid=...