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. Luckily this is very easy to accomplish: SELECT address, '%...@sms.example.com' FROM table WHERE column = '%s' [...] > Now when I send email with the command "sendmail -v u...@example.com" > the mail _does_ make it into u...@example.com's maildir using > virtual(8), but the /root/smsnotif isn't even called (the logfile isn't > created). What do the logs say? Hint: Does the vmail user have access to the /root directory? -- Magnus Bäck mag...@dsek.lth.se