[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

exim and perl filter



In an article in the linux gazette I found the following piece
of code:

-- #!/usr/bin/perl
-- $address = 'my.isp@pp.inet.fi';
-- while(<>){
--         if(/^From: /){ s/<.*>/<$address>/; print; last; }
--         print;}
-- while(<>){ print; }

After naming it /usr/local/bin/mail-filter and changing it's
permissions (chmod +x ) it was meant to be inserted
into /etc/exim.conf as follows:

-- remote_smtp:
--       drivers = smtp
--       headers_remove = "sender"
--       transport_filter = "/usr/local/bin/mail-filter"
-- end

The problem is that it doesn't work and I'm forced to use

-- ulla@hampaita.fi  ulla.russell@pp.inet.fi bcfrF

which works but changes the address of internal mail as well.
Can anyone see any problems with this code. I don't know much
about perl and was wondering if the code contained any obvious
(to perl coders) errors.

It gives the following when I source ( . /usr/local/bin/mail-filter )
it

-- bash: =: command not found
-- bash: /usr/local/bin/mail2: line 3: syntax error near
   unexpected token `while(<>){'
-- bash: /usr/local/bin/mail2: line 3: `while(<>){'





Reply to: