3

I was looking for uploading photos by email documents (in php) but couldn't find good one.

Is there any easy ways to upload pictures/photos by email?

ie. steps,

1) on mobile devices, email a picture to private-email@domain.com
2) copy the picture into our server like facebook or flickr

ps. I run apache servers, mysql and php

hakre
  • 193,403
  • 52
  • 435
  • 836
qweqwe qwe
  • 393
  • 7
  • 16
  • not to hard, look at the php imap functions –  Dec 18 '11 at 20:07
  • thanks for your comment Dagon, are there any samples? – qweqwe qwe Dec 18 '11 at 20:09
  • It's often simplest to set up a PHP script as `procmail` handler for such purposes. (Cron job polling being another workaround). Either way needs mail attachment/decoder, so not quite so simple as just receiving mails. – mario Dec 18 '11 at 20:09
  • 2
    possible duplicate of [How do I receive email and process it in a web application](http://stackoverflow.com/questions/965178/how-do-i-receive-email-and-process-it-in-a-web-application) – mario Dec 18 '11 at 20:10
  • could also pipe all mail to a particular account for processing, i do this for bounce processing –  Dec 18 '11 at 22:04
  • I just found this tutorial http://davidwalsh.name/gmail-php-imap but I couldn't get attachments – qweqwe qwe Dec 19 '11 at 02:31

1 Answers1

0

There are a number of different approaches to receiving email with PHP. The main options are:

  • Retrieve the emails via background job (cron etc) and IMAP/POP3
  • Run a mail server and make that send the content into the app directly (pipe it into php)
  • Use a third party service

I wrote a blog post that was for Rails here, although it's for Rails pretty much all the principals still apply to PHP and translate directly.

Steve Smith
  • 5,146
  • 1
  • 30
  • 31
  • thanks for your answer Steve, are there any third party services for this? – qweqwe qwe Dec 19 '11 at 21:53
  • CloudMailin (which I founded) is one option. We allow you to send the attachments directly to something S3 or use your own php code to take the attachments that get posted directly to you and just upload them to facebook/flickr via the api. – Steve Smith Dec 20 '11 at 15:20