procmail recipe for email to gallery (experts only)
jmullan
Joined: 2002-07-28
Posts: 974 |
Posted: Tue, 2003-07-08 01:23 |
This is a procmail recipe. It goes with your other procmail recipes in your .procmailrc 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: 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 Let me know if this points you in the right direction. You might even not need procmail. Hmm. You must customize this to work with your server. You must have procmail, ripmime, and galleryadd.pl already installed and running. I included an example subject match. Don't do this with every message or your target album will probably fill up with spam images. :0:email2gallery.lock * ^Content-Type:.*multipart/mixed * ^Subject:.*picture | ripmime -i - -d tempdir/ --syslog_on --paranoid --no_nameless &&\ galleryadd.pl -l http://gallery -u username -p password -a album tempdir/* &&\ rm tempdir/* Then again, maybe you want your spam images. If you get it working, you could use this to add images emailed from your cell phone, if you have spent the money on that kind of thing. I haven't. |
|
Posts: 126
Sorry to sound stupid, but where does this code go?
Posts: 974
I updated my message to include more explanation. If it doesn't help, try this other thread, which has an easier method:
http://gallery.menalto.com/index.php?name=PNphpBB2&file=viewtopic&t=7641&highlight=cell
Posts: 5
Should that be --syslog instead of --syslog_on ? I kept getting errors about can't write to a file until I changed that.
Posts: 974
It would appear that you are correct - the changelog for ripmime contains this text:
Posts: 5
Thank you for galleryadd and the example procmail recipe. After figuring out the --syslog thing I'm now using them along with formail to process mailing list archives with thousands of attached images.
I think I've come across a bug. I was processing one of the archives and started getting HTTP error 500 messages to the console. I finally narrowed it down to one attachment. It seems to be a problem with the filename itself. The ripped file is named Jupiter_01_03_04.jpg
If I run galleryadd.pl on that single file I get
And then eventually
If I change the name to just jupiter.jpg it works fine so it's not the file itself. Changing the underscores to dashes gives the same problem. Using the add photos form in gallery worked ok for either underscore or dash.
Posts: 974
I'm not sure what to tell you - do you have this problem with any other file?
Would you mind sending me the file to test?
Posts: 5
This is really odd.
I saved another image file to the name Jupiter-01-03-04.jpg and galleryadd pops it in no problem.That would indicate it's not the filename causing the error. So, I resaved the real image and tried uploading. Error 500. Renamed the file using 'mv Jupiter-01-03-04.jpg Jupiter.jpg' and now galleryadd loads it.
Huh? I'm confused!
As for other files that do this, yes, apparently. I modified the mail archive changing the problem name, but it started throwing errors again at some point. I haven't determined this file yet.
I'll send the Jupiter file shortly.
Posts: 5
I found the source of the problem. It's an obscure bug for sure, but it's there somewhere. In the unlikely event anyone else has a similar problem I will describe what's happening.
I mentioned in my previous posts that a specific file would not upload using galleryadd.pl (timeout error). If the name was changed, the file would load. Or an image with the same name would load. This was reproducible. I found at least one more file that would exhibit the same problem.
Well, turns out the location of the problem is my router. My server sits behind a Dlink router. There are several domains hosted on the server, using name-based virtual hosting. I was attempting to run galleryadd from the server itself to one of these virtual servers. Today I noticed error messages in the logs about the time I was trying to load the file, " do_nat: buffer (1) too small". The domain I was trying to upload to was not in my hosts file, so the requests were going to the router, which is smart enough to loop the requests back to the correct machine on the lan. I've never had any other problems related to this, and the problem would only occur with galleryadd on very specific files. I added the domain to the hosts file so galleryadd contacts the localhost directly. And the problem dissappears, the file uploads correctly. Delete it from the hosts file, the problem comes back. Uploading the offending file to remote hosts also works.
It seems the problem only occurs with specific files, with specific names, when the request has to be routed through the loopback feature of the router.
So, I've avoided the problem by adding the domain to my hosts file, but I am curious if it's a bug in the router with some magical combination of data and filename, or if it's a bug in the galleryremote protocol.
Posts: 16
I'm trying to use this from a sendmail alias and having some problems.
The entry in the alias file looks like (i'm copying root for testing purposes):
The procmail recipe is:
And the error in the maillog is:
It works fine when I call procmail with a test message:
cat testmail | /usr/local/bin/procmail -m /usr/local/etc/procmail/photoblog
When I pass that same message through sendmail
cat testmail | sendmail moblog
it acts like everything is fine but I get the above errors.
Do you have any idea what's causing that "Can't create output" error?
Posts: 974
Perhaps sendmail is running as a user that does not have permissions to write out the files?
Posts: 1
I'd like to have graphic attachments sent via different Yahoo Groups uploaded into albums for each group. Are the steps described here still the best starting point? I'm running Gallery2 at http://kirbymuseum.org/gallery/v/groups/ and would welcome any advice/help/pointers.
- Rand
Posts: 83
i whant pics add via email
how is it worke ?
is there a module i can install ?
please help
http://www.blubbs.com is my page
Posts: 83
please help ???????
http://www.blubbs.com is my page