Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I don't use Linux regularly, but do occasionally and I'm struggling with the email configuration that I'd like to get. I've run through a lot of information and tutorials on configuring Postfix and Courier but haven't found if it's possible to do a few things.

I'd like to store all received emails in a format which would be easy for me to 'post-process' the emails - my preferred choice would be MySQL. I should mention at this point that the server is not to be used in the regular sense of email, but rather for data collection.

The only machine that will need to access the mails is the server itself, to parse the headers and the body and harvest the necessary data.

Is it possible to configure Postfix (or an alternative?) like this, or possibly to execute a script upon receipt of an email, in which I would parse the email and add it to the database myself.

The basic purpose of the server is to receive emails which will then be stored and action taken depending on the contents of the body or the headers of the email.

I'd appreciate any help or nudges in the right direction here, I feel a bit like I'm chasing my tail as it seems that the docs I find assume I'm more au fait with Linux and mail server configuration.

share|improve this question

2 Answers 2

you can configure procmail [ with postfix ], mails - instead of being delivered to user's folder will be delivered on standard input to script defined by you. this script in turn can parse messages and take action [or just store entire mails in database for processing later].

in regular postfix setup you add:

alias_maps = hash:/etc/aliases
alias_database = hash:/etc/aliases

in /etc/aliases you add:

userName: "|/some/script"

and you run

postalias aliases
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.