Ok I will describe my goal:

There is a server.
On it runs postfix.

All mail is sent via localhost (or 127.0.0.1).
Meaning, I run a command and mail is sent, nobody is connecting from
outside and sending.

I need to save to a custom DB the mail after any headers are
changed/added by postfix.
So if user X@MyMail sends a mail M, postfix (perhaps) adds headers to
M, creating M-Final.

I want to save M-Final to a table, (User, SentOrReceived, MailContent)
(X@MyMail, Sent, M-Final).
I then want the mail to be sent.

I would like the command to save M-Final to be something like:
SentToStore sender recipients

If for whatever reason, the save of M-Final to the DB fails, I want
the mail to either retry later or bounce.

--

I am attempting to do this with the Posfix After-Queue Content Filter.
It works, except that mail is never sent because it keeps on hitting
the filter, re-added to the queue, etc.


-tim


On 3/19/14, li...@rhsoft.net <li...@rhsoft.net> wrote:
> Am 19.03.2014 20:59, schrieb Tim Prepscius:
>> so let's say I wanted to do what Lewin said,
>>
>> have normal mail on 25, and then special non filtered mail (mail that
>> has already gone through the filter) on some other port, let's say
>> 10025
>
> then you just configure that listener and avoid asking questions
> in context of pickup and sendmail binary because they are both
> not involved
>
> if your inital post would have had the same content as above the
> first reply would have been that clear - describe your goal and
> not what you have done or think has to be done to reach it
>
> -o mynetworks=192.168.196.0/24 is in such setups typically
> the address of the delivering filter and not a network, in
> mayn cases just 127.0.0.1:10025 has the same result
> ____________________________________________
>
> /etc/postfix/main.cf
> filter_smtpd_recipient_restrictions = permit_mynetworks, reject
>
> /etc/postfix/master.cf:
> 10025           inet  n       -       y       -        60     smtpd
>  -o mynetworks=192.168.196.0/24
>  -o smtpd_client_connection_count_limit=60
>  -o smtpd_recipient_restrictions=$filter_smtpd_recipient_restrictions
>  -o receive_override_options=no_header_body_checks,no_milters
>  -o local_header_rewrite_clients=
>  -o sender_dependent_relayhost_maps=
>  -o content_filter=
>  -o smtpd_delay_reject=no
>  -o smtpd_client_restrictions=
>  -o smtpd_relay_restrictions=
>  -o smtpd_helo_restrictions=
>  -o smtpd_helo_required=no
>  -o smtpd_sender_restrictions=
>  -o smtpd_sender_login_maps=
>  -o smtpd_data_restrictions=
>  -o smtpd_end_of_data_restrictions=
>  -o smtpd_restriction_classes=
>  -o smtpd_error_sleep_time=0
>  -o smtpd_soft_error_limit=1001
>  -o smtpd_hard_error_limit=1000
>  -o smtpd_client_connection_rate_limit=0
>  -o smtpd_client_recipient_rate_limit=0
>  -o smtpd_peername_lookup=no
>  -o smtpd_use_tls=no
>  -o smtpd_tls_security_level=none
>  -o smtpd_sasl_auth_enable=no
>  -o smtpd_reject_footer=
>  -o max_idle=1h
>  -o max_use=1000
>
>
>> At the end of the example filter script there is a sendmail command.
>> Is there anyway to have this work with this scenario?
>>
>> http://www.postfix.org/FILTER_README.html
>>
>> On 3/19/14, li...@rhsoft.net <li...@rhsoft.net> wrote:
>>> as lonf you are talking about pickup there is no port
>>> involved at all and no smtp/smtpd setting is relevant
>>> because it's just not SMTP
>>>
>>> Am 19.03.2014 20:49, schrieb Tim Prepscius:
>>>> I'm looking through the docs of sendmail, seeing how I can get it to
>>>> send to a specific port.  But not seeing it.
>>>>
>>>> Am I looking in the wrong place?
>>>>
>>>> On 3/19/14, Lewin Bormann <der.mess...@yahoo.com> wrote:
>>>>> It seems that the local delivery (pickup?) uses the content filter
>>>>> which
>>>>> it shouldn't, AFAIK.
>>>>> If that is the case, the following master.cf configuration taken from
>>>>> my
>>>>> installation may help:
>>>>>
>>>>> ------ snip -------
>>>>>
>>>>> <ip>:smtp        inet  n       -       n       -       -       smtpd
>>>>>     -o content_filter=myspamfilter
>>>>>     -o receive_override_options=no_address_mappings,no_milters
>>>>>
>>>>> <ip>:587         inet  n       -       n       -       -       smtpd
>>>>>
>>>>> [<ip6>]:smtp inet n -  n       -       -       smtpd
>>>>>     -o content_filter=myspamfilter
>>>>>     -o receive_override_options=no_address_mappings,no_milters
>>>>>
>>>>> [<ip6>]:587 inet n -  n        -       -       smtpd
>>>>>
>>>>> 127.0.0.1:smtp  inet    n -      n       -       -      smtpd
>>>>> [::1]:smtp      inet    n -      n       -       -      smtpd
>>>>>
>>>>> [...]
>>>>>
>>>>> myspamfilter unix  -       n       n       -       -       pipe
>>>>>   flags=Rq user=debian-spamd argv=/etc/postfix/spamchk -oi -f ${sender}
>>>>> ${recipient}
>>>>>
>>>>> -------- snap --------
>>>>>
>>>>> The result is that only mail submitted on port 25 is piped through the
>>>>> content filter (in my case a shell script involving SpamAssassin and
>>>>> sendmail, similar to the mentioned README). Mail on 587 from users and
>>>>> from localhost is not filtered
>

Reply via email to