December 05, 2005

Curious, George: FTP upload: I want an email attachment to upload to my website.

Specifically, I want to use Gmail to receive an email with an attachment, and to have it automatically recognize a certain text string in the subject of the message, and then act on that message by uploading the attached image file to a web server. What I imagine is that the message would be forwarded to some service that could post the attachment. Am I crazy? Please keep in mind I'm relatively stupid when it comes to web tech.

  • And, I forgot to add "Curious George" to this post.
  • Hmm. That's quite a question.
  • You want to send an email with an attachment to a gmail.com address, and have that attachment appear magically on your website? You could do that by writing a program that grabs the emails from gmail via POP, then posts them to your website via HTTP/FTP or whatever your web server understands. I don't know of any programs that specifically do this, but it wouldn't be too hard to write one.
  • Or just use Gmail itself for storage.
  • If you're using a mac, Applescript can do this. The trick is to set up a filter on Apple's mail client that triggers an Applescript to upload the file. You'd need a scriptable ftp client to do it this way. I'm sure you could do something similar in the windows world with visual basic and outlook.
  • Does your website host offer any type of scripting language (ie Perl, PHP, Python, Ruby etc)? If so, it's not that difficult, with the help of someone with skills in the particular language, to set up an email account specifically for this purpose. Receiving an email at that account would automatically fire up your script, which would handle the email according to the logic of the script. The same is probably possible using a script from your web site to a gmail account, using a CRON job to periodically fire the script, but that would add some extra complexity. If your host offers PHP scripting, drop me a message via the link to my site in my profile, and I'll see what I can do to help. If not, there are any number of online communities you could approach for practical advice for the scripting language your host provides.
  • Depending on what you're trying to accomplish, you might want to look into WordPress. It has the ability to check a specific email account, and then take the messages in that account and turn them into blog posts.