Crowley Code! 
 (Take 12)

(Post)fixing your (email) life 2007/12/30

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.

Comments (6)

  1. This looks amazing. I wish I knew what that code meant. I just checked out the code into my local port, and will look at it.

    I really like curvr too :)

    Andrew Mager — 2007/12/31 2:53 pm

  2. Have you looked at the mailparse pecl extension?  I thought it might be able to make curvrmail simpler in the code searching for the jpeg attachment.  I'm not sure whether the docs on php.net are up to date, but it's definitely getting love from Brian Shire, who I understand has made some huge improvements to APC.  (If he's working on it, it also means facebook is probably using it since that's his employer.)

    David — 2008/01/09 5:57 pm

  3. KjIjh6 xpqcaqobldrt, [url=http://zryfcafyclud.com/]zryfcafyclud[/url], [link=http://jjwyskxgyrzq.com/]jjwyskxgyrzq[/link], http://vlnidiaecblc.com/

    fngjedmz — 2008/09/06 8:37 am

  4. [url=http://en.netlog.com/milcyrnaked]Miley Cyrus naked[/url] Miley Cyrus naked [url=http://bebo.com/CloeG38]Blake Lively nude[/url] Blake Lively nude [url=http://ballhype.com/story/angelina_jolie_nude]Angelina Jolie nude[/url] Angelina Jolie nude [url=http://wikio.com/article/70424131]Emma Watson Naked[/url] Emma Watson Naked [url=http://pear.php.net/user/sertlex]Eva Mendes nude[/url] Eva Mendes nude [url=http://freeswitch.org/user/1353]Carmen Electra nude[/url] Carmen Electra nude [url=http://confluence.atlassian.com/display/~fredd]Kim Kardashian sex tape[/url] Kim Kardashian sex tape [url=http://britney.com/blog/nside]Kim Kardashian Naked[/url] Kim Kardashian Naked

    — jzsefnidxi — 2008/09/07 6:13 pm

  5. O9apaC hmL40Mdg41UrgAs6a

    barner — 2008/09/16 12:26 pm

  6. Hey, don't start bashing procmail's syntactic column!  The program may be old, but it's a rather benign entity :-). The colon is a relic from when I was rather young and inexperienced..  Now adding the zero behind it, *that* is the work of a "true genius"... Alas those are the burdens for backward compatibility.  I've learnt since then.

    — Stephen R. van den Berg — 2009/01/05 6:18 am

Richard Crowley?  Kentuckian engineer who cooks and eats in between bicycling and beering.

I blog mostly about programming and databases.  Browse by month or tag.

To blame for...


© 2009 Richard Crowley.  Managed by Bashpress.