Saving email information.

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

Saving email information.

Swati Meghanand

Hi,

Is possible to retrive information like 'sender','recipient','message_size','date' from incoming mail using postfix.

I want to retrive this information from every incoming message and store it to database or text file for reference

(some thing like 'exilog' for exim dose')

Regards,

Swati Kulkarni

Reply | Threaded
Open this post in threaded view
|

Re: Saving email information.

d.hill
On Tue, 22 Jul 2008, Swati Meghanand wrote:

>
> Hi,
>
> Is possible to retrive information like 'sender','recipient','message_size','date' from incoming mail using postfix.
>
> I want to retrive this information from every incoming message and store it to database or text file for reference
>
> (some thing like 'exilog' for exim dose')

You would need to create a policy service:

   http://www.postfix.org/SMTPD_POLICY_README.html

You would need to use it in the smtpd_end_of_data_restrictions:

   http://www.postfix.org/postconf.5.html#smtpd_end_of_data_restrictions

as the message size is not known until then.

-d
Reply | Threaded
Open this post in threaded view
|

Re: Saving email information.

mouss-2
Duane Hill wrote:

> On Tue, 22 Jul 2008, Swati Meghanand wrote:
>
>>
>> Hi,
>>
>> Is possible to retrive information like
>> 'sender','recipient','message_size','date' from incoming mail using
>> postfix.
>>
>> I want to retrive this information from every incoming message and
>> store it to database or text file for reference
>>
>> (some thing like 'exilog' for exim dose')
>
> You would need to create a policy service:
>
>   http://www.postfix.org/SMTPD_POLICY_README.html
>
> You would need to use it in the smtpd_end_of_data_restrictions:
>
>   http://www.postfix.org/postconf.5.html#smtpd_end_of_data_restrictions
>
> as the message size is not known until then.


the problem is that at this stage, he doesn't get the recipients
(multi-rcpt mail), so he needs to call the policy service at rcpt stage
as well.


an alternative is to parse logs.
Reply | Threaded
Open this post in threaded view
|

Re: Saving email information.

Swati Meghanand


2008/7/22 mouss <[hidden email]>:
Duane Hill wrote:
On Tue, 22 Jul 2008, Swati Meghanand wrote:


Hi,

Is possible to retrive information like 'sender','recipient','message_size','date' from incoming mail using postfix.

I want to retrive this information from every incoming message and store it to database or text file for reference

(some thing like 'exilog' for exim dose')

You would need to create a policy service:

 http://www.postfix.org/SMTPD_POLICY_README.html

You would need to use it in the smtpd_end_of_data_restrictions:

 http://www.postfix.org/postconf.5.html#smtpd_end_of_data_restrictions

as the message size is not known until then.


the problem is that at this stage, he doesn't get the recipients (multi-rcpt mail), so he needs to call the policy service at rcpt stage as well.


an alternative is to parse logs.
Hi,

Thanks for ur replies

I am running a postfix mail server with (MySQL based) virtual users and domains running more than 60 domains. I want to grab various information on per-user and per-domain basis. so my idea was to store all incoming mail information in MySQL database,parsing the log file was the pretty good option but I need to update this information in db quickly, it requires continuous parsing the log file as it grows I am not sure that weather this will be possible but currently working on the same.

Regards

Swati Kulkarni
 

Reply | Threaded
Open this post in threaded view
|

Re: Saving email information.

mouss-2
Swati Meghanand wrote:

> 2008/7/22 mouss <[hidden email]>:
>
>> Duane Hill wrote:
>>
>>> On Tue, 22 Jul 2008, Swati Meghanand wrote:
>>>
>>>
>>>> Hi,
>>>>
>>>> Is possible to retrive information like
>>>> 'sender','recipient','message_size','date' from incoming mail using postfix.
>>>>
>>>> I want to retrive this information from every incoming message and store
>>>> it to database or text file for reference
>>>>
>>>> (some thing like 'exilog' for exim dose')
>>>>
>>> You would need to create a policy service:
>>>
>>>  http://www.postfix.org/SMTPD_POLICY_README.html
>>>
>>> You would need to use it in the smtpd_end_of_data_restrictions:
>>>
>>>  http://www.postfix.org/postconf.5.html#smtpd_end_of_data_restrictions
>>>
>>> as the message size is not known until then.
>>>
>>
>> the problem is that at this stage, he doesn't get the recipients
>> (multi-rcpt mail), so he needs to call the policy service at rcpt stage as
>> well.
>>
>>
>> an alternative is to parse logs.
>
> Hi,
>
> Thanks for ur replies
>
> I am running a postfix mail server with (MySQL based) virtual users and
> domains running more than 60 domains. I want to grab various information on
> per-user and per-domain basis. so my idea was to store all incoming mail
> information in MySQL database,parsing the log file was the pretty good
> option but I need to update this information in db quickly, it requires
> continuous parsing the log file as it grows I am not sure that weather this
> will be possible but currently working on the same.
>


you can either use a policy server as Duane suggested (but you'll need
to call it at both rcpt stage and end of data stage. the end of data
stage would not be needed if you don't care about the size), or parse
logs in real time (aka tail -f, but you need to handle log rotation).

the advantage with the policy service is that you don't need to
correlate multiple log lines. the advantage of log parsing is that it is
"out of band" (it does not "distrub" the smtp transactions) and can run
on another machine (since syslog can send logs to a remote machine).

the choice is yours...