Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I'm trying to send a notification to the sender of a message when a message is send to exactly one address in the local domain (test@mydomain.com).

Q1: How would be the syntax for the condition (the above don't work) ? :

notify_reply:
    driver=accept
    domains = +local_domains
    senders = ! ^.*-request@.*:\
            ! ^bounce-.*@.*:\
            ! ^.*-bounce@.*:\
            ! ^owner-.*@.*:\
            ! ^postmaster@.*:\
            ! ^webmaster@.*:\
            ! ^listmaster@.*:\
            ! ^mailer-daemon@.*:\
            ! ^root@.*:\
            ! ^noreply@.*

    condition = ${if eq {$received_for}{test@mydomain.com}}

    no_expn
    transport=notify_transport
    unseen
    no_verify

Q2: How to write multiline string in the config file for "text" ? :

notify_transport:
    driver=autoreply
    from=info@mydomain.com
    to=$sender_address
    subject=Your mail for
    text="Please resend your messasge to

info@mydomain.com

This is a temporary modification."
share|improve this question

1 Answer 1

up vote 1 down vote accepted

Q1: conditions operate on the strings "true"/"yes" or "no"/"false", so you have to make the end result of your expansions be one of those strings. Likewise, ${if doesn't return an absolute true or false, it evaluates the statement and then returns strings based on the truth of the statement (you left those strings off). Here're some example:

g3 0 /home/jj33 > exim -be
> ${if eq{string}{string}{true}{false}}
true
> ${if eq{string}{STRING}{true}{false}}
false
> ${if eqi{string}{STRING}{true}{false}}
true
>

It's important to note that the "true" and "false" strings are arbitrary, you ${if can return any value, but true and false are the most useful to you here. Anyhoo, based on the condition you list, I would change it to this:

condition = ${if eq {$received_for}{test@mydomain.com}{yes}{no}}

EDIT: I think newer versions of exim may not require the extra "if-true" and "if-false" parts, so I may be barking up the wrong tree here. I think that $received_for is probably actually not the variable you want, I doubt that it contains anything at the time you are running that router. Instead, try this:

condition = ${if eqi{$local_part@$domain}{test@mydomain.com}}

Q2: There are a few ways to solve this problem, but I like to use the ${expand: operator:

g3 0 /home/jj33 > exim -be
> ${expand:line1\nline2}
line1
line2

So, in your case, it would be:

text=${expand:Please resend your messasge to\n\ninfo@mydomain.com\n\nThis is a temporary modification.}
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.