Magnus Bäck wrote:
On Wednesday, October 21, 2009 at 19:43 CEST,
     rihad <ri...@mail.ru> wrote:

OK here's how far I've gone:

master.cf:
smsnotif  unix  -       n       n       -       -       pipe
  flags=DRhu user=vmail argv=/root/smsnotif ${recipient}

/root/smsnotif:
#!/bin/sh
echo "$@" >> /tmp/smsnotif.log

(and of course chmod +x /root/smsnotif)

main.cf:
virtual_maps = mysql:/etc/postfix/mysql-virtual.cf mysql:/etc/postfix/mysql-virtual-smsnotif.cf
transport_maps = mysql:/etc/postfix/mysql-transport.cf

/etc/postfix/mysql-virtual.cf:
user = postfix
password = blahblah
dbname = mail
hosts = 127.0.0.1
query = select coalesce(goto,email) from users left join alias on (email=address) where email='%s'

/etc/postfix/mysql-virtual-smsnotif.cf:
user = postfix
password = blahblah
dbname = mail
hosts = 127.0.0.1
query = select replace(coalesce(goto, email), '@', '@sms.') from users left join alias on (email=address) where email='%s'

No, that's not how things work. With

   virtual_alias_maps = A, B

Postfix will only consult B if A doesn't provide any results. You need
to return all addresses in a single lookup result.

Finally everything's working now! Thank you very much. I promise, I _will_ read all of the online documentation from the start.

Hint: Does the vmail user have access to the /root directory?


Indeed, under CentOS /root is disallowed any access from anyone except root, but this was easy to spot in the logs once I've fixed table lookup.

There was no such user as vmail in the system either. I had thought that if these examples are uncommented in master.cf, then the user is probably there. But neither was the user, nor maildrop was installed (which I don't need anyway) ;-)

Reply via email to