Reputation: 1656
I am looking for a wait to schedule tasks based on the reception of an email.
More precisely, I received an email with some attached data every week and I need to add these data into a database (and process some information). Is there a way to do it automatically?
Would airflow be a good option to do this? I found that airflow can send email but I did not find anything about reading mails.
I know it is possible to read email and download attached file in python. But what would be the best way to check if a specific email is received (defined by a sender) and process its data as soon as it is received ?
Upvotes: 4
Views: 1987
Reputation: 959
Airflow is a great option for this workflow.
Airflow has the concept of SensorOperators which are derived from the BaseSensorOperator. Using a SensorOperator will allow you to easily control the poke_interval and timeout of the task as well as how to handle the various situations depending on whether or not the email arrives as expected.
Upvotes: 3
Reputation: 750
You could schedule some BashOperator
or PythonOperator
that periodically checks new mail and if they find one they start processing it. While I cannot give you any specific library, I am sure there must be a way to read and handle email in Python.
Upvotes: 0