Exim4, .forward file

From Andreida
Revision as of 23:08, 19 May 2024 by Andreas (talk | contribs) (→‎Create a vacation message)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Create a vacation message

  • Create a /home/yourUser/.forward file with the following content.
  • Make sure a /home/yourUser/vacation.msg file exists and is not empty.
  • Replace "your-domain.com" with your domain. Something like "google.com" or "playboy.de".
  • The first two ifs are versions how it SHOULD work, but it does not work for me, because $domain is localhost for me, no idea why (yet).
# Exim filter
#if personal then vacation endif
#if personal then
#    mail
#      to $reply_address
#      subject "Re: $h_subject"
#      subject "personal recognized!"
#      text "personal has been recognized by the message with the subject: $h_subject"
#endif

if
not error_message and
$message_headers does not contain "\nList-Id:" and
$message_headers does not contain "\nList-Help:" and
$message_headers does not contain "\nList-Subscribe:" and
$message_headers does not contain "\nList-Unsubscribe:" and
$message_headers does not contain "\nList-Post:" and
$message_headers does not contain "\nList-Owner:" and
$message_headers does not contain "\nList-Archive:" and
(
 "${if def:h_auto-submitted:{present}{absent}}" is "absent" or
 $header_auto-submitted: is "no"
 ) and
$header_precedence: does not contain "bulk" and
$header_precedence: does not contain "list" and
$header_precedence: does not contain "junk" and
#foranyaddress $header_to:
#( $thisaddress contains "$local_part$domain" ) and
#foranyaddress $header_to:
#( $thisaddress contains "$local_part" ) and
foranyaddress $header_to:
( $thisaddress contains "$local_part@your-domain.com" ) and
not foranyaddress $header_from:
(
 $thisaddress contains "$local_part@$domain" or
 $thisaddress contains "server@" or
 $thisaddress contains "daemon@" or
 $thisaddress contains "root@" or
 $thisaddress contains "listserv@" or
 $thisaddress contains "majordomo@" or
 $thisaddress contains "-request@" or
 $thisaddress matches  "^owner-[^@]+@"
 )
then
    logfile $home/.forward.log
    logwrite "Creating vacation mail for $reply_address, $h_subject:"
    mail
#to     Huber@Glancy.com
#       to root@localhost # your test mail, instead of the real recipient
        to $reply_address
        subject "Vacation Re: $h_subject:"
        expand file $home/.vacation.msg
endif


I got this - in a little bit different form - from the internet and I am pretty sure it is from https://www.exim.org/exim-html-current/doc/html/spec_html/filter_ch-exim_filter_files.html.