NeoSHNIK a écrit :
> Hello,
> I am writing a plugin for SA which needs to treat outbound and incoming
> emails differently. So ideally if the message is outbound I call one
> subroutine in my plugin, if not I call another.
> So is there any way to check what type of email it is in SA? I couldn't find
> any.
> Someone said that it is possible to run two copies of Postfix MTA - one for
> incoming, other for outgoing messages. 

There is no need to run two copies.
- the recommended way is to enable the submission service in master.cf
and have outbound mail use port 587
- but even if you use port 25 for both MX and submission, you can use an
access check that returns a FILTER statement which sets different
filters for inbound and outbound mail). a google search (or search
postfix-users archives) will give you examples (I think I posted one
recently).

> And I guess then it would run two
> copies of SA with two different plugins that I write. 

This depends on your setup. There is nothing automatic here.

> But there has to be an
> easier way to do this.
> When the Postfix receives an outgoing message it stores it in the
> ".../Mail/send" right? 
No. The Sent folder has nothing to do with smtp. This folder is accessed
by your MUA via IMAP (so you won't find it on the server if using POP3).

> So if it stores it before it calls SA my plugin could
> search in that file by message-ID. Thank God string searching is easy in
> Perl. 
>   

but unreliable. any spammer can forge message-id's and other headers.

> I could also hardcode the email addresses of the users behind the server
> with SA, but then it would not be safe nor would it scale with high amount
> of users in the network.
>   

if you really want scale, use different machines;-p Divide and conquer...

> Any suggestions?
>   

unless you run two instances of spamd (or amavisd-new or ...) or you run
spamassassin command (not good for perf) with different options, SA
doesn't know if mail is inbound or outbound. The difference between
inbound and outbound is at reception time. In general, outbound mail
comes from a trusted client or was sent with authentication, but this
not necessarily true for every setup.

You could look at headers (either postfix headers or X-Relay-External).

Reply via email to