开发者

Send a picture with Email and upload it automatically

开发者 https://www.devze.com 2023-03-19 02:42 出处:网络
I know that Iphone doesn\'t allow file uploads via web on safari, so i want to test another method. Is there any way i can as a user send an email with a photo as attachment to a specific e开发者_Sta

I know that Iphone doesn't allow file uploads via web on safari, so i want to test another method.

Is there any way i can as a user send an email with a photo as attachment to a specific e开发者_StackOverflow社区mail (lets say uploads@domain.com) and then let it automatically upload the photo to a webserver?


Yes, you either have incoming email piped directly into a script (e.g. with procmail) or you periodically (e.g. with cron) poll a mailbox (e.g. over IMAP) looking for new messages.

Then you just need to parse the mail, extract the image, and copy it to wherever you want to copy it to.

Make sure you have some kind of sensible authentication scheme in place though.


Sure there are quite a few solutions here. You can either fire a script whenever a mail server receives an email, poll on a regular basis or use a third part service. I wrote a blog post about receiving email in ruby and rails. Almost all of the ideas can be taken into PHP and I have done so before as an experiment.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号