Add Via Email Module
Module for adding items via email. Latest version in svn: 0.7.3
This is a Gallery2 module that will check a specified email address for uploaded pictures.
It will then drop them into a specified Album.
This plugin was conceived mainly as a way to easily get pictures into your gallery from your handy-dandy camera phone. I tried to make is very simple and easy as the intended use was with a cell phone without a qwerty keyboard.
I figured if you were at a computer anyway and were able to type all this extra information in anyway, you might as well log on to the gallery directly and use the great interface that already exists.
It is entirely possible i mis-named the module - maybe it should have been 'addviacameraphone'.
- If in POP mode, it will delete the message once its been processed.
- If in IMAP mode, you have the choice as to whether or not it deletes the message.
- If in IMAP mode, it will only check messages marked as new. If if processes one, it will mark it as read.
- The title will be the filename either taken from the email or generated if no filename could be found.
- The body of the message will (optionally) be the Description of the picture.
- Support SSL, and custom POP/IMAP ports.
- Will detect a SprintPCS PictureMail type message, and process correctly.
- Will detect a Cingular type message, and process correctly.
- Will process more than one image per email.
- Checks a user settable parameter to set minimum number of minutes between checks. This is to not overload the mail server, and to not make every hit to your gallery slow.
- SVN: Download the module from the user contib via SVN:
"site Admin" -> "plugins" -> "Get More Plugins" tab -> "Import" section -> download the Add via Email module.
It uses a "block" - someone with Adminstrator privledges must add it to the theme.
I recommend the "sidebar", at the end.
If logged in as Adminstator the addviaemail block will show a status. If not logged
in as Adminstrator the block is silent.
Since this module relies on a gallery page hit, once an email is processed it will appear
on the next page load. If you wish to automate this, AND have the access to do it
you can add
wget -q http://your.gallery.com/main.php?g2_controller=addviaemail.Addviaemailpage -O - > /dev/null
to your crontab for whatever interval you wish. Here is an example that runs every other minute:
*/2 * * * * root wget -q http://picsbeta.example.net/main.php?g2_controller=addviaemail.Addviaemailpage -O - > /dev/null
Remember to change the HOST in the url, and add the directory your gallery is in, if any.
I recommend running http://your.gallery.com/main.php?g2_controller=addviaemail.Addviaemailpage manually from a browser to make sure everything is looking good. You should send a couple of test emails to make sure your settings are ok. Also, you should be logged on as an admin while doing this, the page will give you more information that might be useful in debugging a problem.
Compose an email to the address you specified in the configuration page. The subject MUST match (and it can not be blank) the "Subject to Match" you entered. The picture MUST be an attachment (not inline). The caption of the picture can be set by entering something in the body of the email.
Next you have to get addviaemail to run through its process. This can be accomplished by either adding the Add via Email block to one of your pages in the themes control area in the Site Admin section of gallery.
You can hit it directly with a browser at:
(remember to change the host and add a directory if you have one)
Once you confirm its working, you can then add it to the crontab if you have access to such things.
Features that would be nice to have.
- Add a key to the subject to allow uploading to *any* album, given the right format or something. For example, perhaps [Album Path/to/Proper/Album].
- Send zip file in the email, and adding that album to the gallery: Creating a sub album with the name of the zip file.
- Another neat feature would be to scan the *from* email address and use *that* as the "owner" of the image, and perhaps for permissions on where the image can go. Dunno how easy/hard this would be, but it'd make it great.
- As an added security measure, each user could be perhaps given a random string of chars that they would have to include in the subject of a mail to authorize it.
- Just a suggestion: put an explanation in the warning that the imap functions are required for even pop3 email accounts.
Currently there no known major issues for this module.
- Attached pic has to be an attachment, NOT inline. Not sure if this is a bug.
- When text is present following the image, 2 files are added to gallery -- 1 image+caption (caption= preceding text), 1 of type US-ASCII with just caption. -- Note: this is behavior as tested when uploaded from iPhone. If there is no trailing text after the image -- all is well :)
- Not serious issue but could be addressed: At present, exif and iptc information seems to be ignored.
- Email must be very simple. The email which contains the picture can not contain any other pictures. If it does I believe only the first picture it finds will be uploaded. This is NOT condusive to many phone picture mail messages as these messages tend to have marketing/brainding images as well as the "sent" image.
Developer To Do List
- Work out details for allowing the subject line to also contain a pointer to the target album.
- Refactor code to add capability of processing more than one image per email.
- Put in check on activation for existance of imap_open
Done: 12.22.2006 @ 14:30
- Add drop down to configure page to ask if body of email should be used as caption
- Fix bug where blank fields in configure are not handled correctly
- Add drop down to configure page to ask if SSL should be used, make all changes necessary in supporting class