RE: [Exim] Problem with Subject expansion in autoresponder

Etusivu
Poista viesti
Vastaa
Lähettäjä: Bernard Stern
Päiväys:  
Vastaanottaja: exim-users
Aihe: RE: [Exim] Problem with Subject expansion in autoresponder
On Thu, 9 Aug 2001 12:42:18 -0400 Matt Zito wrote:

Hello,

(...)

> Which worked, except that in messages with extremely long subject lines, the
> user's mua would insert a newline into the subject, which would result in a
> message with the error:


> --------
> This message was created automatically by mail delivery software.


> A message that you sent could not be delivered to one or more of its
> recipients. This is a permanent error. The following address(es) failed:


>   adam@???:
>     Expansion of "${expand:
>     ${lookup mysql {select subject from mailrouting where
> local_part='${quote_mysql:$local_part}' and
> domain='${quote_mysql:$domain}'}{$value}}}" in virtvacation transport
> contains non-printing character 10
> ---------


> So, we modified the "subject" directive to read:


> subject = ${expand: ${escape: ${lookup mysql {VIRTSUBJECT}{$value}}}}


> Hoping that that would cause the newline character to be escaped. That did
> not fix the problem, and it became obvious why when we realized we were
> actually escaping the response from the mysql server, which has no newlines
> in it. We also tried ${escape 'ing the $value key, but it seems to have no
> effect. Is there a workaround for this? Are we doing something wrong? Any
> help would be greatly appreciated.


I have no idea about mysql part, but basically I do cut too long
subject lines, escape and quote them:

${quote:${escape:${length_50:$header_subject:}}}

My whole subject replace looks as follows, with the additional
bonus to put in a subject when there is none or the original
is empty.a

  subject = ${if def:header_subject:\
                {${if match {$header_subject:} {^\\s*\$}\
                    {I am on vacation}\
                    {VACATION-RE: ${quote:${escape:${length_50:$header_subject:}}}}\
                  }\
                }\
                {I am on vacation}\


HTH,

Bernard Stern, SWITCH

____________S_W_I_T_CH___Swiss Academic_______________________________________
        mail: SWITCH Head Office       a          Tel: +41 1 268 1520
              Limmatquai 138           n          Fax: +41 1 268 1568
              CH-8001 Zurich           d        e-mail: stern@???
________________________________________Reseach Network_______________________