sendmail lda parameter for full recipients address

319 views Asked by At

Using this:

define('LOCAL_MAILER_ARGS', 'procmail -t -Yo -a $h -d $u')

in my sendmail mc gives a procmail LOGNAME like

user

instead of

[email protected]

using

define('LOCAL_MAILER_ARGS', 'procmail -t -Yo -a $h -d $u@$h')

gives then

user@localhostname

My problem is, we have email users in the form '[email protected]' and not 'user' - thus procmail can't find e.g. mail directories with just the user address portion 'user'. How can one provide procmail the full recipients address from sendmails lda call?

EDIT:

I'll try it to be more clear, to see the reason.

My 'virtual' recipients are a) no system users and the have different domains in their address, all set with the use_cw_file feature. Local mailer is procmail AND dovecot (+sieve), which is finally handling the virtual users, too. Because dovecot is naming the domain by in addition to the user to handle e.g. [email protected] and [email protected] on the same host.

So I need sendmail to deliver the full address to the lda(stack) (procmail -> sieve -> dovecot).

2

There are 2 answers

1
AnFi On

Sendmail: procmail delivery for virtual domains

You may select procmail mailer with prcoamil script as argument in mailertable (procmail as local mailer is a different beast).

mailertable file:

# deliver messages to domain.tld 
# using etc/procmailrcs/domain.tld.rc procmail script
domain.tld  procmail:/etc/procmailrcs/domain.tld.rc

access (table) file:

to:domain.tls  RELAY

Comments:

  1. procmail treats script in /etc/procmailrcs in special way (see man procmail)
  2. mailertable IS NOT consulted for local email domains so access table entry is required to accept messages to the domain from everywhere.
    As root use echo '$=w' | sendmail -bt to get list of local email domains
  3. You may use virtusertable with _VIRTUSER_STOP_ONE_LEVEL_RECURSION_ to list valid addresses in the domain and reject remaining
  4. By default the scipt will be executed once per every recipient in the domain
1
tripleee On

$LOGNAME is by definition a local user name. I don't think that there is a way to override this (or that there should be one).