rihad:
[ Charset ISO-8859-1 unsupported, converting... ]
> rihad wrote:
> > We have two maps:
> > virtual_mailbox_maps = mysql:/etc/postfix/mysql-virtual-maps.cf
> > virtual_maps =  mysql:/etc/postfix/mysql-virtual.cf
> > 
> > 
> > /etc/postfix/mysql-virtual-maps.cf:
> > user = postfix
> > password = c00lpass
> > dbname = mail
> > table = users
> > select_field = maildir
> > where_field = email
> > additional_conditions = and enabled = 1
> > hosts = 127.0.0.1
> > 
> > /etc/postfix/mysql-virtual.cf
> > user = postfix
> > password = c00lpass
> > dbname = mail
> > table = alias
> > select_field = goto
> > where_field = address
> > hosts = 127.0.0.1
> > 
> > 
> > the first table definitely does recipient validation, as well as getting 
> > their maildir. The latter table has a few important aliases, like info@, 
> > support@, etc going to the real person's email.
> > 
> > Which setting should I tweak? I'm lost, the docs are overwhelming for a 
> > newb like myself :-(
> > 
> 
> 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'
> 
> /etc/postfix/mysql-transport.cf:
> user = postfix
> password = blahblah
> dbname = mail
> table = transport
> select_field = transport
> where_field = domain
> hosts = 127.0.0.1
> 
> mysql> select * from transport;
> +------------------+-----------+------+
> | domain           | transport | desc |
> +------------------+-----------+------+
> | example.com      | virtual   | NULL |
> | sms.example.com  | smsnotif  | NULL |
> 
> 
> so virtual_maps will normally end up as u...@example.com + 
> u...@sms.example.com.
> 
> 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 did I forget?

You forgot to test the virtual alias expansion.

    postmap -q u...@example.com mysql:/etc/postfix/mysql-virtual.cf 

Thus should produce the same result as a hash: table with:

    u...@example.com    u...@example.com, u...@sms.example.com

Ditto for the transport map.

        Wietse

Reply via email to