diff -ur twiki/lib/TWiki/Net.pm twiki.new/lib/TWiki/Net.pm
--- twiki/lib/TWiki/Net.pm	2007-03-03 09:45:57.000000000 -0500
+++ twiki.new/lib/TWiki/Net.pm	2007-08-18 00:21:25.000000000 -0400
@@ -34,6 +34,7 @@
 use Error qw( :try );
 
 use vars qw( $LWPavailable );
+use Encode qw/encode decode_utf8/;
 
 sub new {
     my ( $class, $session ) = @_;
@@ -263,19 +264,35 @@
 }
 
 sub _fixLineLength {
-    my( $addrs ) = @_;
+    my ($addrs) = @_;
+    my ($phrase, $route_addr) = ($addrs =~ /"?([^"]*)"?\s+<(.*)>/);
+    $phrase = decode_utf8($phrase);
+    $phrase = encode('MIME-Header', $phrase);
+    if ($phrase =~ /^=/) {
+        $addrs = $phrase . " <$route_addr>";
+    } else {
+        $addrs = "\"$phrase\" <$route_addr>";
+    }
     # split up header lines that are too long
     $addrs =~ s/(.{60}[^,]*,\s*)/$1\n        /go;
     $addrs =~ s/\n\s*$//gos;
     return $addrs;
 }
 
+sub _fixSubject {
+    my( $subject ) = @_;
+    $subject = decode_utf8($subject);
+    $subject = encode('MIME-Header', $subject);
+    return $subject;
+}
+
 sub _sendEmailBySendmail {
     my( $this, $text ) = @_;
 
     # send with sendmail
     my ( $header, $body ) = split( "\n\n", $text, 2 );
     $header =~ s/([\n\r])(From|To|CC|BCC)(\:\s*)([^\n\r]*)/$1.$2.$3._fixLineLength($4)/geois;
+    $header =~ s/([\n\r])(Subject)(\:\s*)([^\n\r]*)/$1.$2.$3._fixSubject($4)/geois;
     $text = "$header\n\n$body";   # rebuild message
 
     open( MAIL, '|'.$TWiki::cfg{MailProgram} ) ||
@@ -295,6 +312,7 @@
     my @headerlines = split( /\r?\n/, $header );
     $header =~ s/\nBCC\:[^\n]*//os;  #remove BCC line from header
     $header =~ s/([\n\r])(From|To|CC|BCC)(\:\s*)([^\n\r]*)/$1 . $2 . $3 . _fixLineLength( $4 )/geois;
+    $header =~ s/([\n\r])(Subject)(\:\s*)([^\n\r]*)/$1 . $2 . $3 . _fixSubject( $4 )/geois;
     $text = "$header\n\n$body";   # rebuild message
 
     # extract 'From:'
diff -ur twiki/templates/mailnotify.tmpl twiki.new/templates/mailnotify.tmpl
--- twiki/templates/mailnotify.tmpl	2007-03-03 09:46:00.000000000 -0500
+++ twiki.new/templates/mailnotify.tmpl	2007-08-17 17:42:39.000000000 -0400
@@ -57,7 +57,7 @@
 --------------------------------
 %TMPL:DEF{PLAIN:after}%%TMPL:END%
 --------------------------------
-%TMPL:DEF{MailNotifyBody}%From: %WIKIWEBMASTERNAME% <%WIKIWEBMASTER%>
+%TMPL:DEF{MailNotifyBody}%From: "%WIKIWEBMASTERNAME%" <%WIKIWEBMASTER%>
 To: %EMAILTO%
 Subject: %WIKITOOLNAME%.%WEB% - %MAKETEXT{"Automated notification of topic changes"}%
 MIME-Version: 1.0
@@ -66,7 +66,7 @@
 This is a multi-part message in MIME format.
 --=_=0i0k0i0w0tXuOi0E0A
 Content-Type: text/plain; charset=%CHARSET%; format=flowed
-Content-Transfer-Encoding: 7bit
+Content-Transfer-Encoding: 8bit
 
 %MAKETEXT{"This is an automated e-mail from [_1]." args="%WIKITOOLNAME%"}%
 
@@ -81,7 +81,7 @@
 
 --=_=0i0k0i0w0tXuOi0E0A
 Content-Type: text/html; charset=%CHARSET%
-Content-Transfer-Encoding: 7bit
+Content-Transfer-Encoding: 8bit
 
 %HTML_TEXT%
 
diff -ur twiki/templates/mailresetpassword.classic.tmpl twiki.new/templates/mailresetpassword.classic.tmpl
--- twiki/templates/mailresetpassword.classic.tmpl	2007-03-03 09:45:57.000000000 -0500
+++ twiki.new/templates/mailresetpassword.classic.tmpl	2007-08-17 17:43:50.000000000 -0400
@@ -1,5 +1,5 @@
-From: %WIKIWEBMASTERNAME% <%WIKIWEBMASTER%>
-To: %FIRSTLASTNAME% <%EMAILADDRESS%>
+From: "%WIKIWEBMASTERNAME%" <%WIKIWEBMASTER%>
+To: "%FIRSTLASTNAME%" <%EMAILADDRESS%>
 Subject: %MAKETEXT{"TWiki password reset for [_1]" args="%WIKINAME%"}%
 
 %MAKETEXT{"Dear [_1]" args="%WIKINAME%"}%
diff -ur twiki/templates/mailresetpassword.tmpl twiki.new/templates/mailresetpassword.tmpl
--- twiki/templates/mailresetpassword.tmpl	2007-03-03 09:45:56.000000000 -0500
+++ twiki.new/templates/mailresetpassword.tmpl	2007-08-17 17:43:11.000000000 -0400
@@ -1,5 +1,5 @@
-From: %WIKIWEBMASTERNAME% <%WIKIWEBMASTER%>
-To: %FIRSTLASTNAME% <%EMAILADDRESS%>
+From: "%WIKIWEBMASTERNAME%" <%WIKIWEBMASTER%>
+To: "%FIRSTLASTNAME%" <%EMAILADDRESS%>
 Subject: %MAKETEXT{"TWiki password reset for [_1]" args="%WIKINAME%"}%
 
 %MAKETEXT{"Dear [_1]" args="%WIKINAME%"}%
diff -ur twiki/templates/newsletter.tmpl twiki.new/templates/newsletter.tmpl
--- twiki/templates/newsletter.tmpl	2007-03-03 09:46:00.000000000 -0500
+++ twiki.new/templates/newsletter.tmpl	2007-08-14 21:39:27.000000000 -0400
@@ -6,7 +6,7 @@
 Subject: %WIKITOOLNAME% %WEB%.%TOPIC%
 MIME-Version: 1.0
 Content-Type: text/html; charset=%CHARSET%
-Content-Transfer-Encoding: 7bit
+Content-Transfer-Encoding: 8bit
 
 
 %TMPL:END%
diff -ur twiki/templates/registerconfirm.classic.tmpl twiki.new/templates/registerconfirm.classic.tmpl
--- twiki/templates/registerconfirm.classic.tmpl	2007-03-03 09:45:57.000000000 -0500
+++ twiki.new/templates/registerconfirm.classic.tmpl	2007-08-17 17:44:24.000000000 -0400
@@ -1,10 +1,10 @@
-From: %WIKIWEBMASTERNAME% <%WIKIWEBMASTER%>
-To: %FIRSTLASTNAME% <%EMAILADDRESS%>
+From: "%WIKIWEBMASTERNAME%" <%WIKIWEBMASTER%>
+To: "%FIRSTLASTNAME%" <%EMAILADDRESS%>
 BCC: %WIKIWEBMASTER%
 Subject: %MAKETEXT{"How to activate your [_1] registration", "%WIKITOOLNAME%"}%
 MIME-Version: 1.0
 Content-Type: text/plain; charset=iso-8859-1
-Content-Transfer-Encoding: 7bit
+Content-Transfer-Encoding: 8bit
 
 %MAKETEXT{"Thank you for registering in the [_1] collaboration platform. Your verification code is [_2].", "%WIKITOOLNAME%", "%VERIFICATIONCODE%"}%
 
diff -ur twiki/templates/registerconfirm.tmpl twiki.new/templates/registerconfirm.tmpl
--- twiki/templates/registerconfirm.tmpl	2007-03-03 09:45:56.000000000 -0500
+++ twiki.new/templates/registerconfirm.tmpl	2007-08-17 17:44:34.000000000 -0400
@@ -1,10 +1,10 @@
-From: %WIKIWEBMASTERNAME% <%WIKIWEBMASTER%>
-To: %FIRSTLASTNAME% <%EMAILADDRESS%>
+From: "%WIKIWEBMASTERNAME%" <%WIKIWEBMASTER%>
+To: "%FIRSTLASTNAME%" <%EMAILADDRESS%>
 BCC: %WIKIWEBMASTER%
 Subject: %MAKETEXT{"How to activate your [_1] registration" args="%WIKITOOLNAME%"}%
 MIME-Version: 1.0
 Content-Type: text/plain; charset=%CHARSET%
-Content-Transfer-Encoding: 7bit
+Content-Transfer-Encoding: 8bit
 
 %MAKETEXT{"Thank you for registering in the [_1] collaboration platform. Your verification code is [_2]." args="%WIKITOOLNAME%, %VERIFICATIONCODE%"}%
 
diff -ur twiki/templates/registernotify.classic.tmpl twiki.new/templates/registernotify.classic.tmpl
--- twiki/templates/registernotify.classic.tmpl	2007-03-03 09:45:57.000000000 -0500
+++ twiki.new/templates/registernotify.classic.tmpl	2007-08-17 17:44:45.000000000 -0400
@@ -1,9 +1,9 @@
-From: %WIKIWEBMASTERNAME% <%WIKIWEBMASTER%>
-To: %FIRSTLASTNAME% <%EMAILADDRESS%>
+From: "%WIKIWEBMASTERNAME%" <%WIKIWEBMASTER%>
+To: "%FIRSTLASTNAME%" <%EMAILADDRESS%>
 Subject: %MAKETEXT{"[_1] - Registration for [_2] ([_3])", "%WIKITOOLNAME%", "%WIKINAME%", "%EMAILADDRESS%"}%
 MIME-Version: 1.0
 Content-Type: text/plain; charset=%CHARSET%
-Content-Transfer-Encoding: 7bit
+Content-Transfer-Encoding: 8bit
 
 %MAKETEXT{"Thank you for registering in the [_1] collaboration platform. Please save this e-mail for future reference.", "%WIKITOOLNAME%"}%
 
diff -ur twiki/templates/registernotify.tmpl twiki.new/templates/registernotify.tmpl
--- twiki/templates/registernotify.tmpl	2007-03-03 09:45:56.000000000 -0500
+++ twiki.new/templates/registernotify.tmpl	2007-08-17 17:44:53.000000000 -0400
@@ -1,9 +1,9 @@
-From: %WIKIWEBMASTERNAME% <%WIKIWEBMASTER%>
-To: %FIRSTLASTNAME% <%EMAILADDRESS%>
+From: "%WIKIWEBMASTERNAME%" <%WIKIWEBMASTER%>
+To: "%FIRSTLASTNAME%" <%EMAILADDRESS%>
 Subject: %MAKETEXT{"[_1] - Registration for [_2] ([_3])" args="%WIKITOOLNAME%, %WIKINAME%, %EMAILADDRESS%"}%
 MIME-Version: 1.0
 Content-Type: text/plain; charset=%CHARSET%
-Content-Transfer-Encoding: 7bit
+Content-Transfer-Encoding: 8bit
 
 %MAKETEXT{"Thank you for registering in the [_1] collaboration platform. Please save this e-mail for future reference." args="%WIKITOOLNAME%"}%
 
diff -ur twiki/templates/registernotifyadmin.classic.tmpl twiki.new/templates/registernotifyadmin.classic.tmpl
--- twiki/templates/registernotifyadmin.classic.tmpl	2007-03-03 09:45:57.000000000 -0500
+++ twiki.new/templates/registernotifyadmin.classic.tmpl	2007-08-17 17:45:03.000000000 -0400
@@ -1,9 +1,9 @@
-From: %WIKIWEBMASTERNAME% <%WIKIWEBMASTER%>
-To: %WIKIWEBMASTERNAME% <%WIKIWEBMASTER%>
+From: "%WIKIWEBMASTERNAME%" <%WIKIWEBMASTER%>
+To: "%WIKIWEBMASTERNAME%" <%WIKIWEBMASTER%>
 Subject: %MAKETEXT{"[_1] - Registration for [_2] ([_3])", "%WIKITOOLNAME%", "%WIKINAME%", "%EMAILADDRESS%"}%
 MIME-Version: 1.0
 Content-Type: text/plain; charset=%CHARSET%
-Content-Transfer-Encoding: 7bit
+Content-Transfer-Encoding: 8bit
 
 %MAKETEXT{"This is an automated e-mail notification of user registration in [_1].", "%WIKITOOLNAME%"}%
 
diff -ur twiki/templates/registernotifyadmin.tmpl twiki.new/templates/registernotifyadmin.tmpl
--- twiki/templates/registernotifyadmin.tmpl	2007-03-03 09:45:56.000000000 -0500
+++ twiki.new/templates/registernotifyadmin.tmpl	2007-08-17 17:45:14.000000000 -0400
@@ -1,9 +1,9 @@
-From: %WIKIWEBMASTERNAME% <%WIKIWEBMASTER%>
-To: %WIKIWEBMASTERNAME% <%WIKIWEBMASTER%>
+From: "%WIKIWEBMASTERNAME%" <%WIKIWEBMASTER%>
+To: "%WIKIWEBMASTERNAME%" <%WIKIWEBMASTER%>
 Subject: %MAKETEXT{"[_1] - Registration for [_2] ([_3])" args="%WIKITOOLNAME%, %WIKINAME%, %EMAILADDRESS%"}%
 MIME-Version: 1.0
 Content-Type: text/plain; charset=%CHARSET%
-Content-Transfer-Encoding: 7bit
+Content-Transfer-Encoding: 8bit
 
 %MAKETEXT{"This is an automated e-mail notification of user registration in [_1]." args="%WIKITOOLNAME%"}%
 
