Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Processing incoming e-mail data dynamically with scripting language -> database

I would like to process incoming e-mails (on IMAP account) as a e-mail fetching client and feed e-mail data into a scripting language to fill up a specific tables in database. The main goal is to process e-mail body text for data mining and metrics.

Best if run on common UNIX like systems: Linux, *BSD, Solaris

Infrastructure:

Mail Server <---using-IMAP--client<--- My Server--> Scripting lang. -> Database

What I found so far:

  • MTA / fetchmail & procmail
  • getmail (python script)
  • using plain e-mail client to grab emails to ~/.Mailbox and process them (expecting poor performance)

Any suggestions of what may be used to perform such task?

like image 991
M_1 Avatar asked Oct 25 '25 09:10

M_1


1 Answers

For Python, imaplib implements an IMAP4 client.

This and Nelson's answer should give you the template to follow:

  1. Choose a scripting language that you want to use on your server.
  2. Does it have an IMAP client library, extension, or built in functionality?
  3. Does it have a connector to the specific database you want to use (MySQL, Postgres, MSSQL etc.)?
  4. If answers to (2) or (3) are "No", go back to step 1.
  5. ...
  6. Profit!
like image 107
MaxVT Avatar answered Oct 28 '25 04:10

MaxVT