Re: [exim] Help with MySQL user stats

Startseite
Nachricht löschen
Nachricht beantworten
Autor: Jeremy Harris
Datum:  
To: exim-users @ exim. org
Betreff: Re: [exim] Help with MySQL user stats
Mark Elkins wrote:
> In Transports, Under "mysql_delivery:"
> I also have...
>   driver = appendfile
>   directory = /var/spool/mail/$domain/$local_part/
>   maildir_format = true
>   directory_mode = 0755
>   create_directory = true
>   user = smmsp
>   group = smmsp
>   mode = 0660
>   quota = 20M
> # quota = ${lookup mysql {select quota from admin \
> #    where user='${local_part}@${domain}' and status>1}} \
> quota_is_inclusive=false

>
> message_suffix = ${lookup mysql {insert into maillog set
> mfrom='${quote_mysql:$sender_address}', mto='${quote_mysql:$local_part}@
> ${domain}',\
>     mvia='${quote_mysql:$sender_host_address}', msize=${message_size},
> mdelivered=current_timestamp, mailid='$message_id',
> mspam='$spam_score_int',\
>     mreturn='${quote_mysql:$return_path}' }{}{}}

>
>
> Again - this is a hack (using "message_suffix"). If exim had a
> "dbrequest" function, then Duncan's Exim Logger could collect data real
> time.


Hacks I have used:

(transport)
lmtp_to_extern:
   driver =              smtp
   protocol =            lmtp
[...]
# Want to log a rcpt_audit_msg.
# The size-limit is a red-herring; we leave as disabled, only needing the
# side-effect of the lookup.
   message_size_limit =  ${lookup pgsql{ \
              INSERT INTO \
              VALUES( RCPT_AUDIT_ID, \
              'send out for external filtering' )}\
                          {0}{0}}


(router)
lookup_delivery:
     driver =            redirect
     address_data =    [lookup something useful here]


# The data lookup is only used to write a DB record; success results in
# an empty list so the router declines.
   data =                ${if eq {}{\
                             ${lookup pgsql{ \
                                 INSERT INTO \
[...]
} \
                             {}{oops}}} \
                         {}{:defer:}}



(router)
recipient_log:
   driver =              accept
   condition =           ${lookup pgsql{ SELECT \
[....] ) \
                                 }{no}fail}
   transport =           local_smtp



But yes, they're gratuitous misuse of the facilities.

Cheers,
     Jeremy