通过Email发送图片并自动上传
我知道Iphone不允许在safari上通过网络上传文件,所以我想测试另一种方法。
作为用户,我有什么方法可以发送带有照片作为特定电子邮件附件的电子邮件(比方说 [电子邮件受保护]),然后让它自动将照片上传到网络服务器?
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 email (lets say [email protected]) and then let it automatically upload the photo to a webserver?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
是的,您要么将传入的电子邮件直接通过管道传输到脚本中(例如,使用 procmail),要么定期将传入电子邮件传输到脚本中(例如,使用 < a href="http://en.wikipedia.org/wiki/Cron" rel="nofollow">cron)轮询邮箱(例如通过 IMAP) 寻找新消息。
然后你只需要解析邮件,提取图像,并将其复制到你想要复制到的任何地方。
不过,请确保您有某种合理的身份验证方案。
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.
当然,这里有很多解决方案。您可以在邮件服务器收到电子邮件时触发脚本、定期轮询或使用第三方服务。我写了一篇关于 在 ruby 和 Rails 中接收电子邮件。几乎所有的想法都可以应用到 PHP 中,我之前也做过这样的实验。
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.