2

I'm trying to automate a task I do every night. An email is sent to my inbox with a html link in it. The text can be a little different each day but there is always one link. I need to then download this file from the link and put it in Dropbox.

I've been trying to use a bunch of cloud automation tools (Zapier, IFTTT, etc) and I am unable to figure this out.

I don't want to host a server just to do a simple task like this. I also don't want to have it run locally on my computer because my computer is not always on.

I'm almost there, but really the main problem is there is no good free tools to parse content from email. Once I have the link, Zapier can download the file and save to Dropbox.

Any ideas?

halfer
  • 19,824
  • 17
  • 99
  • 186
erotsppa
  • 14,248
  • 33
  • 123
  • 181

1 Answers1

0

I'd look into writing a Python script that uses the imaplib module to fetch and parse the email message - then you could try using the Dropbox Python client to upload the file. (There are probably several other ways to handle those pieces as well if those approaches don't work out.)

Once you have a working Python script, you would have a lot of choices for where to run it - since you don't want to maintain a machine to run the script on, I'd suggest running the script in AWS Lambda.

You can drop the Python script there, and schedule the job to run nightly. Then you'll never have to manage a server, and only running once a day would presumably keep you in Amazon's free usage tier for Lambda.

The intro Python Lambda docs are at:

http://docs.aws.amazon.com/lambda/latest/dg/python-lambda.html

Note that you can use "pip install" to install packages in Python Lambda functions:

https://aws.amazon.com/lambda/faqs/#functions-python

Finally, there's a premade Lambda blueprint (their name for prebuilt templates) named "lambda-canary" that you could use to get started.

Once you set a name and a time to trigger the function, you can simply paste your Python code into a premade template via a web browser. As of this writing, the process looks like:

  • Go to https://console.aws.amazon.com/lambda
  • Click the "Get Started Now" button
  • Click the "lambda-canary" button
  • Set a name and scheduled time for the lambda and click Next
  • Edit your code in the browser and save when ready
Bill Agee
  • 3,606
  • 20
  • 17