简体   繁体   English

发送带有Email的图片并自动上传

[英]Send a picture with Email and upload it automatically

I know that Iphone doesn't allow file uploads via web on safari, so i want to test another method.我知道 Iphone 不允许通过 safari 上的 web 上传文件,所以我想测试另一种方法。

Is there any way i can as a user send an email with a photo as attachment to a specific email (lets say uploads@domain.com) and then let it automatically upload the photo to a webserver?作为用户,我有什么办法可以发送带有照片的 email(比如说 uploads@domain.com),然后让它自动将照片上传到网络服务器?

Yes, you either have incoming email piped directly into a script (eg with procmail ) or you periodically (eg with cron ) poll a mailbox (eg over IMAP ) looking for new messages.是的,您要么将传入的 email 直接通过管道传输到脚本中(例如使用procmail ),要么定期(例如使用cron )轮询邮箱(例如通过IMAP )以查找新消息。

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.您可以在邮件服务器收到 email 时触发脚本、定期轮询或使用第三方服务。 I wrote a blog post about receiving email in ruby and rails .我写了一篇关于在 ruby 和 rails 中接收 email的博客文章。 Almost all of the ideas can be taken into PHP and I have done so before as an experiment.几乎所有的想法都可以纳入 PHP 并且我之前已经这样做了作为实验。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM