I've created a website for a local radio station (wabb.com) and they have a new request. They got the cell phones that can take and email pictures. They want to be able to email those pics to the server and have a predetermined gallery pick up the pictures and display them. I don't really need it to be secure, only they will know the email address. The two tricky parts are 1. extracting the pic from the email when it gets to the machine and 2. Having gallery rebuild the album on command and display the new pics.
I'm using sendmail, and I know there's someway to make it pipe incoming messages for a certain (user? domain?) to an app, but I don't know how. And I'd MUCH rather have the incoming mail start the process than have a cron job run every 5 minutes looking for mail. That would be a major waste of resources because they're only going to be posting a few every few days.
Any done anything like this before?
Thanks,
Benny Butler
Posts: 974
There might be easier ways to do this, but I use a multi-step process. Each piece may be a little complicated, but they interact in a simple way. You will need procmail, ripmime, and galleryadd.pl.
Here's the flow for my installation:
1) Emails are received by postfix. Sendmail works in a similar fashion.
2) Emails are piped through procmail.
http://www.procmail.org/
3) Procmail checks to see if the email meets certain criteria (subject, sender, etc.)
4) Procmail sends the email to ripmime, which extracts the attachments
http://www.pldaniels.com/ripmime/
5) Procmail then runs galleryadd.pl to put the attachments into the gallery
6) Procmail runs rm to clean up the attachments
7) You can have procmail also run stripmime to remove the attachments from the email if you want to get the email without attachments
http://www.phred.org/~alex/stripmime.html
My procmail recipe is here:
http://gallery.menalto.com/index.php?name=PNphpBB2&file=viewtopic&t=7457&highlight=galleryadd+pl
Let me know if this points you in the right direction. You might even not need procmail. Hmm.
Posts: 7994
You might also consider using MFOP which does the same thing. Jesse's solution gives you greater control over every aspect of the solution, but MFOP might get you up and running faster.
Posts: 2
I think for now I'll try bharat's solution. I'm a little leary about using a third party service because A, I'd be giving someone else access and B, they may be gone in a month. But on the other hand, I'm not too sure how much this radio station is going to use this feature. They have a habit of asking for things, I produce and they only use it for a month.
Thanks guys!
Posts: 260
yeah well MFOP will not be gone in a month and the latest features include possibility to create new albums (plus description) even in sub albums, have the pics uploaded in specific albums/sub-albums, multiple images in one email, including multiple captions. and all of that in a single email...