This documentation is for Dovecot v2.x, see wiki1 for v1.x documentation.
Differences between revisions 1 and 2
Revision 1 as of 2006-12-22 21:21:25
Size: 1308
Editor: TimoSirainen
Comment:
Revision 2 as of 2006-12-22 21:24:17
Size: 1339
Editor: TimoSirainen
Comment:
Deletions are marked like this. Additions are marked like this.
Line 1: Line 1:
= Mail executable = = Post-login scripting =
Line 3: Line 3:
If you want to do something special before beginning the IMAP or POP3 session, you can do this by changing the `mail_executable` setting to run a script. Below are some examples for what this can be used for. If you want to do something special after authentication, but before beginning the IMAP or POP3 session, you can do this by changing the `mail_executable` setting to run a script. Below are some examples for what this can be used for.

Post-login scripting

If you want to do something special after authentication, but before beginning the IMAP or POP3 session, you can do this by changing the mail_executable setting to run a script. Below are some examples for what this can be used for.

Last-login tracking

If you want to know when the user last logged in, you can do it like this:

# a) Filesystem based timestamp in user's home directory
touch ~/.last_login
# b) SQL based tracking. Beware of potential SQL injection holes if you allow
# users to have ' characters in usernames.
#echo "update last_login = now WHERE user = '$USER'" | mysql mails

# Finally execute the imap/pop3 binary. If you use both, you'll need two scripts.
exec /usr/local/libexec/dovecot/imap

Custom mailbox location autodetection

See MailLocation for an example.

Alerts

If you want to give the user's client some warning notification, you can do it just by writing it to stdout. Although note that not all clients show the alerts, even though IMAP RFC requires it.

if [ -f ~/.out-of-office ]; then
  echo "* OK [ALERT] You're still marked as being out of office."
fi

# Finally execute the imap/pop3 binary. If you use both, you'll need two scripts.
exec /usr/local/libexec/dovecot/imap

None: PostLoginScripting (last edited 2022-02-04 22:55:54 by TimoSirainen)