Posts tagged “procmail”
12/30 (Post)fixing your (email) life (2)
This post is about two things. Most proudly it is about me finally taking the time to setup all of the necessary gears and levers for my phone to post processed photos through to Flickr. Bonus-ly, it is about rolling what seems like your own email server from a few config files and Yahoo! Mail (or GMail, if your twisted brain is so inclined).
First, the fun stuff. I posted in November about curvr, my automated and assumption-filled command-line Photoshop. Refresher course here: http://rcrowley.org/2007/11/08/introducing-curvr/. The day after I wrote curvr I started to experience what can only be described as “crunch time” on Flickr Uploadr, so a quick shell script called curvall was born so I could at least use curvr after Bluetoothing photos from my phone.
Almost two months later and this is just silly. A different kind of crunch time, if you will. From a distance the solution isn’t nearly as ugly as the syntax of .procmailrc but I won’t be mean. I setup an MX record for my domain to send mail to the box in my apartment. From there, postfix rejects the riff-raff and passes the good stuff on to procmail which either works photos over with curvr or forwards to Yahoo! Mail for my consumption.
Postfix, there’s more to life than UNIX accounts
We need to teach postfix what email addresses to accept.
/etc/postfix/virtual:
r@rcrowley.org rcrowley@localhost SPECIAL_CURVRMAIL_ADDRESS@rcrowley.org rcrowley@localhost
/etc/postfix/main.cf (available in SVN):
# See /usr/share/postfix/main.cf.dist for a commented, more complete version
# Debian specific: Specifying a file name will cause the first
# line of that file to be used as the name. The Debian default
# is /etc/mailname.
#myorigin = /etc/mailname
smtpd_banner = $myhostname ESMTP $mail_name (Ubuntu)
biff = no
# appending .domain is the MUA's job.
append_dot_mydomain = no
# Uncomment the next line to generate "delayed mail" warnings
#delay_warning_time = 4h
# TLS parameters
smtpd_tls_cert_file=/etc/ssl/certs/ssl-cert-snakeoil.pem
smtpd_tls_key_file=/etc/ssl/private/ssl-cert-snakeoil.key
smtpd_use_tls=yes
smtpd_tls_session_cache_database = btree:${queue_directory}/smtpd_scache
smtp_tls_session_cache_database = btree:${queue_directory}/smtp_scache
# See /usr/share/doc/postfix/TLS_README.gz in the postfix-doc package for
# information on enabling SSL in the smtp client.
myhostname = banzai
alias_maps = hash:/etc/aliases
alias_database = hash:/etc/aliases
myorigin = /etc/mailname
mydestination = banzai, localhost.localdomain, localhost
relayhost =
mynetworks = 127.0.0.0/8
mailbox_size_limit = 0
recipient_delimiter = +
inet_interfaces = all
# Nasty homegrown config
virtual_alias_domains = rcrowley.org
virtual_alias_maps = hash:/etc/postfix/virtual
mailbox_command = /usr/bin/procmail
It really is important not to put the same domain in mydestination and virtual_alias_domains. Fecal matter and oscillating device and all that. Then run these commands:
$ sudo postmap /etc/postfix/virtual $ sudo postfix reload
Procmail, your syntactic colon is full of shit
If photo, Flickr it. If not, throw it out into the cold.
~/.procmailrc (also available in SVN):
:0 bfW * ^TO_<SECRET_CURVRMAIL_ADDRESS>@rcrowley.org | /home/rcrowley/bin/curvrmail :0 E : ! <normal_forwarding_destination>@yahoo.com
Now, Stephen R. van den Berg willing, email to your special address will be sent through curvr and onto Flickr (assuming you updated the curvrmail script with your secret Flickr email address) and all of your normal email will be forwarded somewhere else.
Yahoo-oooo!
I admit it, I like Yahoo! Mail. So I have my .procmailrc forwarding to Yahoo! Mail. Over at Yahoo! Mail I have a default mailbox setup as the-first-letter-of-my-first-name@rcrowley.org so that I can also send mail as my better email address.
Anyway, it’s all in SVN: http://svn.rcrowley.org/svn/curvr/
I’m interested to know how similar this all is to Aaron’s filtr workflow.