Uploading Images by Email
- Started
- Last post
- 19 Responses
- thirtytwo
I was wondering if anyone here has successfully created an app to do this. I want to be able to email images to my server and have them save into a dir, and update a simple table. This is exactly what Flickr does. I was just wondering if anyone had any tips; or good places to start looking.
Thanks in advance.
- determinedmoth0
If you wanted browser upload I could help you.
- thirtytwo0
I have done the browser way, I want to look into the email way. I think it might save time for clients to be able to email there site content and images.
Anyone?
- j_red0
i looked into doing something similar, i was told that you need some sort of server-side program to run when it gets an email and parse the content to the correct place(DB, image folder, etc)If you ever figger something out let a brother know.
- determinedmoth0
Good idea though.
I think you'd need access to the email server though. You'd have to configure it to detect a pattern and filter the attachements to a web server. Of course this would ideally be the same machine.
- thirtytwo0
Most shared hosting solutions are setup that way. Email dir are local to web dir. I would need to detect the pattern, then move the file and update body to content table. Then remove the email. I could schedule a CRON job to do this. One I get this squared, I will post a sample with the code.
- thirtytwo0
Ok, so I have this working now. I have a page that grabs the image(s), the subject and the body. Then formats the content, adds links and breaks. I now need to save it to a db. I will post the page and the email address for testing when I am done.
- UndoUndo0
it would be good to see how you have done that
- JazX0
huh?
FTP is fine
- madirish0
JazX, read his question. he wants to build in a system that makes it as easy as possible for the client to accomplish this task. 90% of clients out there have zero idea what FTP is, let alone how to "use it".
- ldww0
look into procmail.
procmail is loaded on most servers, forinstance i had a client where was forwarded to a php script with procmail, then processed and acted upon. i am sure you can do the same thing if the email contains an attachment.
- JazX0
ahhh my bad, I misunderstood you
- Carty0
i dont know fuck all about code.. but this website... http://hiptop.bedope.com/ hiptopnation has it setup so you can email images from your phone.. all you need to do is put "hn" in the subject line and they go online... so .. have a look at the code and see if you can figure it out.. or ask the administrator.
good luck.
- thirtytwo0
I have my PHP page make an IMAP connection to my localhost mail server then grab the attachment, then save the file to a local dir, then save the image path, subject, and email body into a table. This is the same thing that Flickr does, just not as enterprise level. Just need to get the bugs worked out and I will post a working sample here for you guys to break, and then let me know if you want the code.
- UndoUndo0
thanks for the info,
is this with the IMAP functions in php? have you tried it with POP accounts?
- UndoUndo0
cool, yeah I've seen the funcs but never tried with POP accounts. did you do this?
- thirtytwo0
I used this one:
$mbox = imap_open ("{localhost:995/pop3/ssl/novali... "user_id", "password");
It seemed the most reliable.
- UndoUndo0
do you know if the account yr connecting to is an IMAP or POP account??
- thirtytwo0
It's IMAP that's why I used that connection.