[Exim] transport filter and mysql lookup failing

トップ ページ
このメッセージを削除
このメッセージに返信
著者: Steve Cole
日付:  
To: exim-users
題目: [Exim] transport filter and mysql lookup failing
Hi Folks,
I had a transport filter running which performed a MySQL lookup on an
address. This worked fine whilst the transport was using the appendfile
driver.
I now need the same functionality but require to use the smtp driver
instead.
Upon changing this - the MySQL lookup now fails.

Below is the transport in question - the lines which are commented out were
the settings used when using the appendfile driver.

For information:
Basically I want the transport to add a custom header called X-FaxNumber -
containing an entry from the MySQL table.
The transport filter will then use this custom header to perform other
header re-writes
The resultant message then gets passed onto another smtp server running on
my fax gateway.

#Run transport filter to make other changes to headers.
faxgate_delivery:
driver = smtp
hosts = 192.168.1.3

headers_remove = To
# Commented options reflect settings for 'driver=appendfile'
# driver = appendfile
# user = faxgate
# group = mail
# mode = 0660
# file = /var/mail/faxgate
# debug_print = true


transport_filter = /var/mail/tfilter-prod1.pl

   headers_add =  To: \n\
                 X-FaxNumber: "${lookup mysql {select faxaddr from
faxdetails \
                                 where
username='${quote_mysql:$parent_local_part}'} \
                                 {${quote_mysql:$value}} {"Invalid"}}"



In my Perl transport filter I'm writing out the headers to a debug text
file, and the faxnumber is coming back with "Invalid" (ie not matching)
Yet when I was delivering the message to a file (via appendfile) the MySQL
query worked.

I can only assume the issue is to do with the fact that $parent_local_part
is not a valid variable now I'm delivering to another smtp server (ie using
driver=smtp)

Could anyone possibly suggest what I should be looking at doing to fix this?

(I have to use SMTP now, and can't run the message out to a mailbox (like
previously) as the fax gateway is new and doesn't support pop3))

Any help would be gratefully appreciated.

Regards

Steve.