Latest LQ Deal: Latest LQ Deals
Go Back > Forums > Linux Forums > Linux - Software
User Name
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.


  Search this Thread
Old 11-26-2005, 11:56 PM   #1
LQ Newbie
Registered: Jul 2005
Location: california, usa
Distribution: kubuntu
Posts: 6

Rep: Reputation: 0
Question Wanted: Batch Email Script for Snapfish photo-uploads

I'm uploading 400+ photos to 12 at a time, keeping a text file open in vim to bookmark which ones I've uploaded, and clearing the last 12 out of the main directory with gthumb so I don't have to scroll manually through hundreds of files every upload, it's much easier to process one screenful when forced to suffer the upload-by-file process. The 12 cent prints are worth it, but almost not.

I'm fairly sure there's a way to do it with mutt, pine or sendmail to mail in photos from a given folder as attachments, say in groups of 5 photos per email. I've never uploaded to Snapfish via email before as it seemed like a rather unwieldy and inefficient interface, but since it's the only open-interface I've found so far that Snapfish offers, it's where my thoughts are focused.

Flickr is doable via a python script I know, but the prints are 20 cents each which is double Snapfish's 10 cents per print if you pre-pay for 1000. Shutterfly's api is more accessible I think, as I noticed that the php opensource app called 'Gallery' lets you crossload them from your webspace to Shutterfly's, but again, they're 19 cents each!

Any good python/bash/perl scripters want to help us?

this is what I've got so far, but I

need help:
adding a counter
& getting mutt to not request confirmation in order to send it off...

#! /bin/bash
mutt -s photos `for f in *jpg; do echo -a $f; done`

the idea is that I would set up a filter in gmail that autofowarded mail from mpm@localhost.localhost to snapfish...

ubuntu/kubuntu user

p.s. I noticed that someone asked about this similar issue about a month ago, yet I decided to start fresh as they had no responses as of yet. Their post is threadid 378384. I'd post a direct link, but as I have yet to reach the 5 posts status won't risk it :-)
Old 05-28-2006, 11:48 PM   #2
LQ Newbie
Registered: Jul 2005
Location: california, usa
Distribution: kubuntu
Posts: 6

Original Poster
Rep: Reputation: 0
snapfish email uploader

I figured it out eventually.
(crossposted from my weblog

I’m a fan of Snapfish, mainly because I can get digital prints at $0.10 per 4 x 6 if I prepay for 1000 prints ($100.00). Even after shipping, it works out a little cheaper than Costco or other local cheap digital developers. I like the prints truly developed like traditional film, not printed, as it feels and looks just a bit better.

Anyway, I was flustered by the lack of uploading software for Snapfish available for Linux. I can’t stand the web interface where you have to browse/attach each photo in batches of 10 or whatever, that is such an awful UI for more than a handful of files. Failing to google anything up as nice as a python script based on the Snapfish API (I don’t think they’ve made their API available even), I settled on an email-based solution.

But email really didn’t seem like an efficient way of uploading, especially not if I was going to have to manually compose and attach photos to each email then send them.

Enter mutt & putmail. These are the only two packages you need to make this work.
(You could of course use postfix or sendmail as your smtp senders, but I went with putmail as it seemed simple and light). Install them & set it up so you can send a test email succesfully to yourself. rather than using my domain-less home box as the sender, I set it up to route through gmail’s free smtp service.

Here’s my ~/.putmail/putmailrc:

server =
email =
username = fubar
password = F00bar
port = 587
tls = true

You’ll also need to set “set sendmail=”/usr/local/bin/” in your ~/.muttrc file. Once that’s up and running, just make a script in ~/bin or wherever you keep them with as many lines as you need to cover the variations in filenames (or use fancier regex if you know it).

Here’s the bare essential line:

#! /bin/bash
for file in *JPG; do mutt -s $file -a $file < /dev/null ; done
for file in *jpg; do mutt -s $file -a $file < /dev/null ; done

In English, this says, for each file with the *jpg ending in this directory, do invoke mutt to send it to with the subject line the same as the filename, and get your standard input from the void (essentially bypass mutt’s asking you questions and prompting you to type a message for each email). Don’t forget to chmod +x your script, whatever you call it, mine is simply ‘muttfish.’

Make sure you check your email preferences at snapfish’s site so they put the files where you want them and also, that you authorize Snapfish to receive from the email address you’ll be sending them from. Then make a copy of the photos you’ll want to upload into a temp directory, and run the script there.

I like to use gthumb’s catalog feature (Alt+E+A, enter) to add everything I want to upload from various directories to a temporary album, then make a copy of that catalog’s contents (select all) to a temporary directory.

I’ve since begun using mutt fulltime as my main email client, even though I like gmail’s UI, learning the features & conveniences of keyboard bindings in mutt, and the gpg integration is very nice. Someday I’ll get it set up with an imap account and email will function as it should. Hope this helps you.


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
script batch linux cetoute14 Linux - General 5 09-02-2005 07:37 PM
Change batch script to shell script alan.belizario Programming 5 03-31-2005 12:41 AM
Change batch script to shell script alan.belizario Linux - Software 1 03-30-2005 01:49 AM
photo upload script mohapi Linux - Software 0 07-15-2003 10:21 AM
Batch mv and tr script ... OrangeWarp Linux - General 1 12-11-2002 05:14 AM > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 05:40 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration