I run a Postfix/Dovecot mail server for personal use. There's only a handful of actual mailboxes, essentially just postmaster@domain.com and username@domain.com.I frequently use the virtual file to create virtual mailboxes forwarded to username@domain.com. I have a number of these for throwaway accounts like one-time purchases from online stores, online games I want to try without worrying about ongoing spam, etc. To do so I SSH and run the following commands:sudo vim /etc/postfix/virtual# add a line that looks like:# # username_servicename@domain.com      username@domain.comsudo postmap virtualsudo service postfix restartI do this with enough frequency that I'd like to automate the process to some degree. I considered simply writing a shell script that took the virtual mailbox and real mailbox as arguments and made the changes itself, but am hoping for something even more hands off.I would like to be able to send an email from username@domain.com to some other mailbox on the server with the virtual mailbox name as the body of the message. The issue would be the sudo calls but I can create a new user whose sole responsibility is to handle this which should handle that.Mostly the question is this: how would I create an event that would be triggered by an email? Is there a service somewhere that does this? Can I configure either Postfix or Dovecot to listen for that email and run commands on that event?
Run script on receipt of email
email;postfix;dovecot