[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[postfix-jp:03129] Re: www.amavis.org はどこへ?



おはようございます、蕪木@自宅です。

amavisd-new の改造ポイントの追加です。

通知メッセージを日本語化するのに下記の変更が必要でした。

−−−−−−−−−−

4.ヘッダー部分:string_to_mime_entity を下記のように修正

> sub string_to_mime_entity($) {
>     my($mail_as_string_ref) = @_;
>     my($entity); my($m_hdr,$m_body);
>     my($taint) = substr($$mail_as_string_ref,0,0);
>     ($m_hdr,$m_body) = ($1.$taint, $3.$taint)
>         if $$mail_as_string_ref =~ /^(.*?\r?\n)(\r?\n|$(?!\n))(.*)$(?!\n)/s;
>     $m_body = safe_encode($bdy_encoding, $m_body);
>     # make sure _our_ source line number is reported in case of failure
>     eval {$entity = MIME::Entity->build(
>         Type => 'text/plain', Encoding => '-SUGGEST', Charset => $bdy_encoding,
>         (defined $notify_xmailer_header && $notify_xmailer_header eq ''
>             ? ()  # leave the MIME::Entity default
>             : ('X-Mailer' => $notify_xmailer_header) ), # X-Mailer hdr or undef
>         Data => $m_body); 1}  or do {chomp($@); die $@};
>     my($head) = $entity->head;
>     # insert header fields from template into MIME::Head entity
>     $m_hdr =~ s/\r?\n([ \t])/$1/g;  # unfold template header
>     for my $hdr_line (split(/\r?\n/,$m_hdr)) {
>         if ($hdr_line =~ /^([^:]*):\s*(.*)$(?!\n)/s) {
>             my($fhead,$fbody) = ($1.$taint, $2.$taint);
>             # encode according to RFC 2047 if necessary
>             if ($fhead =~ /^(X-.*|Subject|Comments)$(?!\n)/si &&
>                 $fbody =~ /[^\011\012\040-\176]/ # nonprint. except TAB and LF?
>             ) { # encode according to RFC 2047
>                 my($fbody_octets) = $fbody;  # non- UTF-8 -aware
> #
> # T.Kabu 2003.07.29
> #
>                 $fbody_octets = safe_encode($hdr_encoding, $fbody);
> #
>                 if ($unicode_aware && Encode::is_utf8($fbody)) {
>                     $fbody_octets = safe_encode($hdr_encoding, $fbody);
>                     do_log(5,"string_to_mime_entity UTF-8 body:  $fbody");
>                     do_log(5,"string_to_mime_entity body octets: $fbody_octets");
>                 }
>                 $fbody = MIME::Words::encode_mimeword($fbody_octets,
>                                                       'Q', $hdr_encoding);
>             } else {  # supposed to be in plain ASCII, let's make sure it is
>                 $fbody = safe_encode('ascii', $fbody);
>             }
>             $fhead = safe_encode('ascii', $fhead);
>             do_log(5, sprintf("string_to_mime_entity %s: %s", $fhead,$fbody));
>             # make sure _our_ source line number is reported in case of failure
>             eval {$head->replace($fhead,$fbody); 1} or do {chomp($@); die $@};
>         }
>     }
>     $entity;  # return the built MIME::Entity
> }

---
Takeshi Kaburagi
Mail Official : kabu@xxxxxxxxx / Private : kabu@xxxxxxxxxxx
HomePage : http://www.fwnet.jp/~kabu/
NOMIKAI : http://www.Murayakuba.jp/

References
[postfix-jp:03128] Re: www.amavis.org はどこへ?, T.Kabu

[検索ページ] [Postfix-JP ML Home]