Finished/FAQ! (Re: [exim] aliases, :fail:, include text from…

Top Page
Delete this message
Reply to this message
Author: Troy Engel
Date:  
To: exim-users
Old-Topics: Re: [exim] aliases, :fail:, include text from a file?
Subject: Finished/FAQ! (Re: [exim] aliases, :fail:, include text from a file?)
Philip Hazel wrote:
>
> Yes, that looks OK. You could use a router like this:


Thanks a ton! I messed with it a little bit, it needed a reply_transport
set and the filter file needs to use $h_to: (instead of local_part) in
order to trap the original address it was directed at (job-1234).

Maybe you could get this as a FAQ/cookbook entry? Lemme see if I can
write it up...

== snip ==
Q: How can I send a nicely formatted auto-response email message to one
time use ("tear off") email addresses, such as public job postings to
mailing lists, websites, and the like?

A: Assume you have a one time use email address such as
"job-1234@???" in your aliases file; the position has been
filled and you want to close the address.

First, create two files in your /etc/mail/ (or otherwise appropriate
location) directory; one will be a systemwide filter to handle the
incoming closed job redirect, the other will be the text returned to the
user.

   jobfilter.txt: (systemwide filter)
     # Exim filter
     if error_message then finish endif
     mail
      subject "Job Closed: $h_to:"
      from "do-not-reply@${qualify_domain}"
      reply_to "do-not-reply@${qualify_domain}"
      expand file "/etc/mail/jobmessage.txt"
     seen finish


   jobmessage.txt: (text returned to user)
     Greetings,
      The job has been closed.
     Regards, Staff


Second, add a special router in your exim config file to trap the
incoming redirected alias "jobclosed" and to use the filter above; note
in the example below the 'user' line must match your system, and the
'address_reply' is typically already in your config file for the
userforward router; be sure to check both with your setup:

   ## jobclosed
   # This is to trap closed jobs; it will run a system filter and respond
   # to the user with a nice message.
   jobclosed_router:
     driver = redirect
     local_parts = jobclosed
     allow_filter
     file = /etc/mail/jobfilter.txt
     reply_transport = address_reply
     user = mail


Lastly, simply edit your aliases file to redirect the closed job to your
new router that matches the local_parts above ("jobclosed"):

   job-1234:    jobclosed


Note: in the filter example above, 'seen finish' is used to blackhole
any incoming email to that job; if you want to save a copy you can
insert something like:

deliver "hr-archive@${qualify_domain}"

...to forward a copy first over for later retrieval/use.
== snip ==

-te

--
Troy Engel | Systems Engineer
Fluid Inc. | http://www.fluid.com