Archives
Trending
Support
Login
clear text
XML
Django
JavaScript
MATLAB
C
C++
C#
Python
SQL
Shell
Bash
Markdown
YAML
JSON
HTML
CSS
PHP
Java
Ruby
Go
Rust
Swift
Kotlin
Arduino
TypeScript
Perl
Autohotkey
Lua
SQF
R
Scala
Haskell
Groovy
Dart
Clojure
VB.NET
Objective-C
PowerShell
Bash
CoffeeScript
Verilog
First, go to master.cf and register your script "myhook" by adding the following line: myhook unix - n n - - pipe flags=F user=www-data argv=/path/to/script.sh ${sender} ${size} ${recipient} Also, edit smtp line to tell Postfix to run the filter for any mail arriving via the SMTP delivery: smtp inet n - - - - smtpd -o content_filter=myhook:dummy Please note that if you are sending mails using the "sendmail" command, the filter will not trigger. In this case, add the option after the "pickup" delivery method: pickup fifo n - - 60 1 pickup -o content_filter=myhook:dummy Restart postfix: postfix reload Make your script readable and executable by anybody: chmod +rx script.sh Note that script is always triggered for any mail arriving. To specify exact address see @MariusMatutiae answer.
Mark as private (unlisted)
for 30 minutes
for 6 hours
for 1 day
for 1 week
for 1 month
for 1 year
everlasting (like CCCP)