Changeset 994

Show
Ignore:
Timestamp:
04/16/02 15:33:45 (11 years ago)
Author:
bradfitz
Message:

<lj user=avva>:
This patch does two things:

1. Correctly encodes Subject: fields in emails as per RFC2047.
Note it uses MIME::Words , which should be on all our servers (I think
it's part of the standard distribution, but it's better to check).
2. Inserts a meta tag with encoding information in the beginning of
the HTML part of the email (some mail readers aren't smart enough to
apply the Content-type: information already there in the MIME header
to HTML attachments, so this gives them a clue).

Tested.

<lj user=bradfitz>:
the lj-bml-init/INSTALL changes

Location:
trunk
Files:
3 modified

Legend:

Unmodified
Added
Removed
  • trunk/cgi-bin/lj-bml-init.pl

    r941 r994  
    3030use LJ::TagGenerator ':html4'; 
    3131use Digest::MD5 qw(md5_hex); 
     32use MIME::Words qw(encode_mimewords); 
     33 
    3234require 'imageconf.pl'; 
    3335require 'propparse.pl'; 
  • trunk/doc/INSTALL.txt

    r857 r994  
    9191        Image::Size 
    9292        FCGI 
     93        MIME::Tools 
    9394        MIME::Lite 
    9495        Compress::Zlib 
     
    111112If you're using Debian this should get everything: 
    112113 
    113 # apt-get install libwww-perl libfcgi-perl libmime-lite-perl \ 
     114# apt-get install libwww-perl libfcgi-perl libmime-perl libmime-lite-perl \ 
    114115                  libsoap-lite-perl libgd-perl liburi-perl \ 
    115116                  libimage-size-perl libdbd-mysql-perl libdbi-perl \ 
  • trunk/htdocs/talkpost_do.bml

    r981 r994  
    514514                 } 
    515515 
     516                 if ($headersubject) { 
     517                     $headersubject = encode_mimewords($headersubject, 
     518                                          ('Charset'=>$encoding)); 
     519                 } 
     520 
    516521                 my $fromname = $up->{'user'} ? "$up->{'user'} - LJ Comment" : "LiveJournal Comment"; 
    517522                 my $msg =  new MIME::Lite ('From' => "$LJ::BOGUS_EMAIL ($fromname)", 
     
    540545 
    541546                 my $html = ""; 
    542                  $html .= "<BODY BGCOLOR=#EFEFFF TEXT=#000000 LINK=#0000FF VLINK=#A000C0>"; 
     547                 $html .= "<head><meta http-equiv=\"Content-Type\" content=\"text/html; charset=$encoding\"></head><BODY BGCOLOR=#EFEFFF TEXT=#000000 LINK=#0000FF VLINK=#A000C0>"; 
    543548                 $html .= "<TABLE><TR VALIGN=TOP><TD>$whopic</TD><TD WIDTH=100%><B>$who</B>$whouserhtml replied to <A HREF=\"$LJ::SITEROOT/talkread.bml?${jargent}itemid=$ditemid\">your LiveJournal comment</A> in which you said:</TD></TR></TABLE>\n\n"; 
    544549                 my $htmlbody = $parentcomment; 
     
    617622         } 
    618623 
     624         if ($headersubject) { 
     625             $headersubject = encode_mimewords($headersubject, 
     626                                  ('Charset'=>$encoding)); 
     627         } 
     628 
     629 
    619630         my $fromname = $up->{'user'} ? "$up->{'user'} - LJ Comment" : "LiveJournal Comment"; 
    620631         my $msg =  new MIME::Lite ('From' => "$LJ::BOGUS_EMAIL ($fromname)", 
     
    649660          
    650661         my $html = ""; 
    651          $html .= "<BODY BGCOLOR=#EFEFFF TEXT=#000000 LINK=#0000FF VLINK=#A000C0>"; 
     662         $html .= "<head><meta http-equiv=\"Content-Type\" content=\"text/html; charset=$encoding\"></head><BODY BGCOLOR=#EFEFFF TEXT=#000000 LINK=#0000FF VLINK=#A000C0>"; 
    652663         if ($parentcomment)  { 
    653664             $html .= "<TABLE><TR VALIGN=TOP><TD>$whopic</TD><TD WIDTH=100%><B>$who</B>$whouserhtml replied to another comment somebody left in <A HREF=\"$LJ::SITEROOT/talkread.bml?${jargent}itemid=$ditemid\">your LiveJournal post</A>.  The comment they replied to was:</TD></TR></TABLE>\n";