[Exim] Autoreplies with MySQL

Top Page
Delete this message
Reply to this message
Author: o.cook
Date:  
To: exim-users
Subject: [Exim] Autoreplies with MySQL
I've hacked up C033 a bit to take autoreply messages from a MySQL database.
However, it's currently hinging on a vacation.txt file being present. What
I'd like to achieve is, if there's a record in the database (see code below)
then send the autoresponse; if there's don't, and deliver the message in
both cases. I'm currently using the following in my Exim configuration. Any
help would be gratefully received.

auto_responder_transport:  
  driver =  autoreply
  text = "\
***** This message is automatically generated by email software. *****\n\
***** The delivery of your message has not been affected.        *****\n\n\
${lookup mysql {SELECT message FROM autoresponder WHERE
address='${local_part}@${domain}'}{$value}}\
"
  to = "${sender_address}"
  subject =  "${if def:h_Subject: {Autoreply: $h_Subject:} {Automated
Reply}}"


end

auto_responder_director:
  driver = localuser
  transport = auto_responder_transport:  
  require_files = ${home}/vacation.txt
  # do not reply to errors or lists
  senders = "! ^.*-request@.*:\
              ! ^owner-.*@.*:\
              ! ^postmaster@.*:\
              ! ^listmaster@.*:\
              ! ^mailer-daemon@.*"
  # do not reply to errors and bounces or lists
  condition = "${if or {{match {$h_precedence:} {(?i)junk|bulk|list}} \
                        {eq {$sender_address} {}}} {no} {yes}}"
  # carry on checking regardless of the outcome of this  director...
  unseen
  no_expn
  no_verify


Best regards,

Ollie