Craig Barratt a écrit :
> Jean-Claude,
>
>> The RFC 2822 forbids the inclusion of non-ASCII characters in any e-mail
>> header, including the subject.
>
> You're right. Try this:
>
> - Add:
>
> use Encode;
>
> near the top of bin/BackupPC_sendEmail (after the other "use" lines).
>
> - Change the charset in $Conf{EMailHeaders} to utf-8:
>
> $Conf{EMailHeaders} = 'MIME-Version: 1.0
> Content-Type: text/plain; charset="utf-8"';
>
> (Note the embedded newline; the second line should not be
> indented - ie: no whitespace at the start of the line.)
>
> If that works correctly I should make this setting the default.
>
> Craig
Hello Craig,
I finally managed to solve the problem. This is a patch for BackupPC 3.0
(in addition to your configuration changes) :
@@ -47,6 +47,7 @@
use Getopt::Std;
use DirHandle ();
use vars qw($Lang $TopDir $BinDir $LogDir %Conf);
+use Encode;
die("BackupPC::Lib->new failed\n") if ( !(my $bpc = BackupPC::Lib->new) );
$TopDir = $bpc->TopDir();
@@ -349,6 +350,7 @@
sub sendUserEmail
{
+ return if ( $Conf{BackupsDisable} != 0 );
my($user, $host, $mesg, $subj, $vars) = @_;
$vars->{user} = $user;
$vars->{host} = $host;
@@ -357,7 +359,7 @@
$vars->{domain} = $Conf{EMailUserDestDomain};
$vars->{CgiURL} = $Conf{CgiURL};
$subj =~ s/\$(\w+)/defined($vars->{$1}) ? $vars->{$1} : "\$$1"/eg;
- $vars->{subj} = $subj;
+ $vars->{subj} = encode('MIME-Header', $subj);
$mesg =~ s/\$(\w+)/defined($vars->{$1}) ? $vars->{$1} : "\$$1"/eg;
SendMail($mesg);
$UserEmailInfo{$user}{lastTime} = time;
I added a test to avoid sending emails when backups are disabled.
Regards,
Jean-Claude
-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
BackupPC-users mailing list
[email protected]
List: https://lists.sourceforge.net/lists/listinfo/backuppc-users
Wiki: http://backuppc.wiki.sourceforge.net
Project: http://backuppc.sourceforge.net/