Re: [exim] Running mysql query

Pàgina inicial
Delete this message
Reply to this message
Autor: Troy Settle
Data:  
A: Juuso Töytäri
CC: exim-users
Assumpte: Re: [exim] Running mysql query
Juuso,

You can make your queries wherever you want, I have queries in both the
router and transport:

users:
        driver                          = accept
        condition                       = ${lookup mysql{MYSQL_USER}}
        transport                       = address_directory
        log_as_local                    = no


address_directory:
        driver                          = appendfile
        maildir_format                  = true
        maildir_use_size_file           = true
        directory                       = ${lookup 
mysql{MYSQL_DIRECTORY}{$value}}
        delivery_date_add
        envelope_to_add
        return_path_add
        maildir_tag                     = ,S=$message_size
        quota                           = ${lookup mysql{MYSQL_QUOTA}}
        quota_size_regex                = ,S=(\d+)
        user                            = ${lookup mysql{MYSQL_DOMAIN_UID}}
        group                           = ${lookup mysql{MYSQL_DOMAIN_UID}}
        directory_mode                  = 0755
        mode                            = 0600
        quota_warn_threshold            = 80%



MYSQL_USER is a query that returns 0 or 1, depending on if it's a valid
account.
MYSQL_DIRECTORY returns /path/to/user/Maildir/
MYSQL_QUOTA returns a value, in bytes (MB*1024*1024)
Please don't ask what MYSQL_DOMAIN_UID returns, or why I use it to set
both UID and GID.

I hope this helps...

--
Troy Settle
Pulaski Networks
http://www.psknet.com
866.477.5638



Juuso Töytäri wrote:

> Hi all;
>
> I in need to run one mysql query when user recieves a mail.
> But i dont have any clue where or how to run it.
>
> Here is the transport part:
>
> virtual_delivery:
> driver = appendfile
> file = /var/spool/mail/${lookup mysql {MYSQL_Q_BOXNAME}{$value}}
> user = Debian-exim
> group = mail
> mode = 0660
> directory_mode = 0770
> MYSQL_QUERY
>
>
> and router:
>
> virtual_mailbox:
> driver = accept
> domains = ${lookup mysql {MYSQL_Q_LOCAL}{$value}}
> transport = virtual_local_md_delivery
>
>
> Im thinking of putting the command to transport part but dont know how.
> Any help would be nice.
>
> Best regards,
> Juuso
>
>