SPUG: sending emails

luis medrano lmzaldivar at gmail.com
Tue Feb 20 15:14:39 PST 2007


Hi,

I have script to send emails but when I send a email with double byte
characters it will send non-readible characters for example:

日本AV女優
维基百ç§',自ç"±çš„百ç§'全书
跳转到: 导航, �索

Any of you knows how perl can respect the double byte charecters when
it sends the email?

here is the script:

#!/bin/perl
my $email_file="tot.txt";
open (FILE, $email_file) or die;
my @emails=<FILE>;
close(FILE);
my $content=shift(@ARGV) || die ("error:give the name of the file content");


open (FILE, $content) or die;
my @contents=<FILE>;
close(FILE);

print "subject of the email \n";
my $title=<STDIN>;
chomp($title);
foreach my $line (@emails){
chomp($line);
my $random_number = int(rand(2));
if ($random_number==1){
#print $random_number . "\n";

open (MAIL, "|/usr/sbin/sendmail -t ");
        print MAIL "From: posting\@mailserver\n";
        print MAIL "To: $line\@mailserver\n";
        print MAIL "Content-Type: text/plain\n";
        print MAIL "Subject: $title\n\n";
        print MAIL "@content";
close (MAIL);
}
sleep(5);
}
print "done \n";

Thanks,
Luis


More information about the spug-list mailing list