From: Michele Carandente on
Hi to everybody.
I've setup postfix to queue all the outgoing emails.
Basically I've add in master.cf this line:
hold unix - - n - - smtp

And in main.cf I've wrote:
defer_transports = hold
default_transport = hold

The problem is that the queued emails will be in deferred queue, and
I've to manually put in hold queue with the command 'postsuper -h
ALL'.

There is a way to put queued email directly in hold queue?

Thanks a lot

From: Barney Desmond on
On 4 February 2010 20:40, Michele Carandente <carandente(a)gmail.com> wrote:
> Hi to everybody.
> I've setup postfix to queue all the outgoing emails.
> Basically I've add in master.cf this line:
> hold      unix  -       -       n       -       -       smtp
>
> And in main.cf I've wrote:
> defer_transports = hold
> default_transport = hold

Your "hold" service is just a duplicate of the regular smtp service.
You might as well have left default_transport alone, and set
defer_transports=smtp

> The problem is that the queued emails will be in deferred queue, and
> I've to manually put in hold queue with the command 'postsuper -h
> ALL'.
>
> There is a way to put queued email directly in hold queue?

There's more than one way to do this. Googling for "postfix hold all
mail" turns up various MailScanner guides and some archives from this
list.

While MailScanner is somewhat frowned upon here, it'll help you get
the idea: http://wiki.linuxquestions.org/wiki/Using_MailScanner/Postfix/SpamAssassin/ClamAV_in_Gentoo_Linux
grep for "hold all incoming messages"

An old list posting that uses a second instance (not necessary here):
http://irbs.net/internet/postfix/0606/1285.html
The key is "smtpd_data_restrictions = static:HOLD"

I've only done this once before, to punish a customer. I can't seem to
find that config now, so you'll need to read a bit to make some sense
of it. What you're wanting to do should be fairly clean and simple to
do.

From: Michele Carandente on
Hi,
sorry if I write again, but I've found how to queue directly in HOLD.
Basically the option is:
smtpd_sender_restrictions = static:HOLD

But in this way all the emails will be queued, even the internal one...
There is a way to queue just the emails that will be relayed externally?
Googling a bit I found that should be something like:
smtpd_sender_restrictions = permit_auth_destination static:hold
but it's not working for me...

In my configuration I'm matching the internal addresses in
transport_maps = proxy:mysql:/etc/postfix/mysql-virtual_transports.cf

Thanks
Michele

From: Wietse Venema on
Michele Carandente:
> Hi,
> sorry if I write again, but I've found how to queue directly in HOLD.
> Basically the option is:
> smtpd_sender_restrictions = static:HOLD
>
> But in this way all the emails will be queued, even the internal one...
> There is a way to queue just the emails that will be relayed externally?
> Googling a bit I found that should be something like:
> smtpd_sender_restrictions = permit_auth_destination static:hold
> but it's not working for me...

It works exactly as documented: permit the request when the RECIPIENT
is internal; otherwise, hold the message.

These, and other features, are painstakingly documented in, for
example, http://www.postfix.org/postconf.5.html

In particular, client features are documented unter
http://www.postfix.org/postconf.5.html#smtpd_client_restrictions

Sender features are documented under
http://www.postfix.org/postconf.5.html#smtpd_sender_restrictions

See also: http://www.postfix.org/SMTPD_ACCESS_README.html

Wietse

From: Michele Carandente on
Hi Wietse,
I had a look at the links that you've suggested me.
If I've understand correctly, I don't have to use the
'smtpd_sender_restrictions' option, because I have to match the
receiver and, if it's in transport_maps =
proxy:mysql:/etc/postfix/mysql-virtual_transports.cf, then means that
it's internal and don't need to be in queue.

So I guess I need to use the option 'smtpd_recipient_restrictions'
At the moment it is that option: smtpd_recipient_restrictions =
permit_mynetworks, permit_sasl_authenticated,
reject_unauth_destination

So now I think I've to modify it, so that I'll tell that if the
receiver is matching with an address of transport_maps (Internal
email), then nothing, otherwhise put all the emails in HOLD.

This is the theory. But pratically how the
smtpd_recipient_restrictions should look like?

Thanks
Michele