Re: [exim] Creating autoreply in utf-8

Kezdőlap
Üzenet törlése
Válasz az üzenetre
Szerző: Kjetil Torgrim Homme
Dátum:  
Címzett: POLONKAI Gergely
CC: exim-users
Tárgy: Re: [exim] Creating autoreply in utf-8
On Tue, 2007-01-02 at 11:33 +0100, POLONKAI Gergely wrote:
> I'm creating an autoreply transport. It's working well on my older
> machine, which uses an ISO-8859-1 character set, but on the new one, the
> whole database is in UTF-8, so I should generate the autoreply message
> in utf-8. Here is the transport I tried:
>
> vacation_autoreply:
>         driver = autoreply
>         to = ${sender_address}
>         from = "${local_part}@${domain}"
>         subject = ${lookup pgsql {PGSQL_Q_AWAYSUBJECT}{$value}}
>         text = ${lookup pgsql {PGSQL_Q_AWAYTEXT}{$value}}
>         headers_add = "Content-Type: text/plain; charset=utf-8"

>
> However, as I know, the headers_add adds the header to the original
> message, not the generated one. Is it possible to add the header to the
> generated message?


here's my transport:

vacation_message:
  driver = autoreply
  once_repeat = 7d
  once = /var/lib/exim/tripnote/TRIPNOTE_USER=\
             ${md5:TRIPNOTE_SUBJECT TRIPNOTE_BODY}.db
  to = $sender_address
  from = $local_part@$domain
  subject = ${rfc2047:Auto: TRIPNOTE_SUBJECT (was: $h_subject: )}
  headers = \
    Auto-Submitted: auto-replied\n\
    MIME-Version: 1.0\n\
    Content-Transfer-Encoding: 8bit\n\
    Content-Type: text/plain; charset="UTF-8"
  text = TRIPNOTE_BODY


the TRIPNOTE_FOO are macros which expand to a database lookup for the
real value. note that since I use $h_subject, I need to set the global
option

headers_charset = UTF-8

so that $h_subject: is decoded to the same charset as the subject stored
in the database. also note how the once-database is named -- it means
that whenever the user changes the message, a sender will receive a new
copy even if he already got one yesterday. a periodic cron job deletes
the "once" database files which haven't been modified in 7 days.

(yes, I know it's a bug that this sends raw 8bit even to hosts not
supporting 8BITMIME, since Exim doesn't support down-converting
content-transfer encodings.)
--
Kjetil T.