I would like to redirect emails with the subject 'Your Parcel has Arrived.' to a local email alias [email protected]. To do this I have created the following router:
redirect_packages:
debug_print = "R: redirect_packages with subject $header_subject"
driver = redirect
domains = +local_domains
condition = ${if eq {$header_subject} {Your Parcel has Arrived.} {true} }
data = packages@${domain}
I cannot get the result of the condition to be true. The debug output is:
--------> redirect_packages router <--------
local_part=me domain=example.com
checking domains
cached yes match for +local_domains
cached lookup data = example.com
example.com in "+local_domains"? yes (matched "+local_domains" - cached)
-considering: R: redirect_packages with subject $header_subject
----expanding: R: redirect_packages with subject $header_subject
-------result: R: redirect_packages with subject Your Parcel has Arrived.
----(tainted)
R: redirect_packages with subject Your Parcel has Arrived.
checking "condition" "${if eq {$header_subject} {Your Parcel has Arrived.} {true} }"...
-considering: ${if eq {$header_subject} {Your Parcel has Arrived.} {true} }
-considering: $header_subject} {Your Parcel has Arrived.} {true} }
---expanding: $header_subject} {Your Parcel has Arrived.
-------result: {Your Parcel has Arrived.
-considering: true} }
---expanding: true
-------result: true
---condition: eq {$header_subject} {Your Parcel has Arrived.} {true}
-----result: false
---expanding: ${if eq {$header_subject} {Your Parcel has Arrived.} {true} }
-------result:
redirect_packages router skipped: condition failure
I can't see what is going wrong. $header_subject is expanded correctly in the debug message. However, in the condition it does not get matched with text that looks the same.
The way the condition is expanded also looks wrong, as if it misses the closing bracket after $header_subject.
Can someone explain what is happening with the condition and why the result is not true?
I ended up with another syntax. It seems the space between the } { is not stripped away: