Search
-
Recent Posts
Tags
adwords amazon analytics api apple aws blog chrome chromium cloud Design dropbox ec2 email error facebook firefox google google-apps homebrew ipad javascript jQuery linux lion mac microsoft mysql osx os x paypal php plugin quicksilver raspberry pi scam social spam twitter ubuntu unix video windows woo wordpress
Tag Archives: procmail
fake procmail script
This is similar to fake sendmail. Need a procmail script to deliver messages locally on your machine? Need to do postfix development local for mail ? This will override the “to” field on postfix (more or less) by saving all mail to a local file. Here is a PHP script you can use: Tweak it to fit your needs, adjust #!/usr/bin/php to point to the php file that you use on your system if necessary ( try which php ) The script may need to be in a folder that it has write access to, or that postfix / procmail has write access to. After saving the script to something like /usr/local/fake-procmail.sh edit /etc/postfix/main.cf and add or edit this line: mailbox_command = /usr/local/fake-procmail.sh Also make sure you make the script executable: chmod +x /usr/local/fake-procmail.sh You will also need to route all mail to the localhost by adding these lines: luser_relay = [email protected] local_recipient_maps = mydestination = pcre:/etc/postfix/mydestinations Change johndoe to your user name. Also create a file /etc/postfix/mydestinations and add this to it: /.*/ ACCEPT More info about that here. Then restart postfix if needed: sudo /usr/sbin/postfix stop sudo /usr/sbin/postfix start And try sending a message, or piping some text to the script: echo hello there | mail -s “test message” [email protected] Or echo hello there | /usr/local/fake-procmail.sh There should now be messages in /tmp/procmail-messages/ – change the script to change the location where they are saved. It’s easier than setting up and chrooting postfix on Mac OS X Lion … Continue reading