My users would like to customize their Subject line in their
.vacation.msg. I found this post which comes close to what I need:
http://www.exim.org/lurker/message/20080301.212100.fb8dc5ea.fi.html
But it won't work unless everyone adds the Subject line. I am looking
for an "if there's a Subject line in .vacation.msg use it, else use
generic Auto-Reply Re: $h_subject". I would like some feedback on this
vacation transport and see if anyone can help refine it. The regexes
seem to do what I expect in pcretest, but I am not very confident about
the if match syntax:
uservacation_transport:
driver = autoreply
user = ${local_part}
mode = 700
file = ${home}/.vacation.msg
file_expand
once = ${home}/.vacation.db
log = ${home}/.vacation.log
once_repeat = 7d
from = $local_part@$domain
to = $sender_address
address_data = ${readfile{${home}/.vacation.msg}}
# If there is a subject: line
subject = ${if {match {$address_data}{^[Ss]ubject:.*\n.*}}\
# True, so use it
{${sg {$address_data}{^([Ss]ubject:.*)\n(.*)}{\$1}}}\
# False, use generic subject
{"Auto-Reply Re: $h_subject"}}
# If there is a subject: line
text = ${if {match {$address_data}{^[Ss]ubject:.*\n.*}}\
# True, so use everything but that line
${sg {$address_data}{^([Ss]ubject:.*)\n(.*)}{\$2}}}\
# False, use the raw .vacation.msg
{$address_data}}
Thanks
Matt