summaryrefslogtreecommitdiff
path: root/tests/mail_to_db.pl
diff options
context:
space:
mode:
authorunknown <jani@hynda.mysql.fi>2001-12-27 16:23:46 +0200
committerunknown <jani@hynda.mysql.fi>2001-12-27 16:23:46 +0200
commitd324d476850889209ae95c3aa667c56509ae7adb (patch)
tree7ee4fc3aa04acf3d046f1a269d02bd27c96edb40 /tests/mail_to_db.pl
parente0473960774175402fdc5430f7a48a2ad88aa052 (diff)
downloadmariadb-git-d324d476850889209ae95c3aa667c56509ae7adb.tar.gz
New version of mail_to_db.pl
tests/mail_to_db.pl: New verision of mail_to_db.pl
Diffstat (limited to 'tests/mail_to_db.pl')
-rwxr-xr-xtests/mail_to_db.pl66
1 files changed, 51 insertions, 15 deletions
diff --git a/tests/mail_to_db.pl b/tests/mail_to_db.pl
index 6433b4248b8..671e8b23599 100755
--- a/tests/mail_to_db.pl
+++ b/tests/mail_to_db.pl
@@ -17,7 +17,7 @@ use DBI;
use Getopt::Long;
$| = 1;
-$VER = "2.5";
+$VER = "2.6";
$opt_help = 0;
$opt_version = 0;
@@ -153,29 +153,64 @@ sub main
$ignored = ($mail_no_from_f + $mail_no_subject_f + $mail_no_txt_f +
$mail_too_big + $mail_duplicates + $mail_fixed);
- print "Mails inserted:\t\t\t\t\t$mail_inserted\n\n";
+ print "################################ Mail Report #################################\n\n";
+ print "Mails inserted:\t\t\t\t\t$mail_inserted\n";
+ print "--------------- ";
+ print "=" . "=" x length("$mail_inserted") . "=\n\n";
if ($ignored)
{
print "Ignored mails\n";
print "-------------\n";
- $mail_no_from_f ?
- print "Reason: mail without \"From:\" -field:\t\t$mail_no_from_f\n" :
+ if ($mail_no_from_f)
+ {
+ print "Reason: mail without \"From:\" -field:\t\t$mail_no_from_f\n";
+ }
+ else
+ {
print "";
- $mail_no_txt_f ?
- print "Reason: mail without message:\t\t\t$mail_no_txt_f\n" :
+ }
+ if ($mail_no_txt_f)
+ {
+ print "Reason: mail without message:\t\t\t$mail_no_txt_f\n";
+ }
+ else
+ {
print "";
- $mail_no_subject_f ?
- print "Reason: mail without subject:\t\t\t$mail_no_subject_f\n" :
+ }
+ if ($mail_no_subject_f)
+ {
+ print "Reason: mail without subject:\t\t\t$mail_no_subject_f\n";
+ }
+ else
+ {
print "";
- $mail_too_big ?
- print "Reason: mail too big (over $opt_max_mail_size bytes):\t$mail_too_big\n" :
+ }
+ if ($mail_too_big)
+ {
+ print "Reason: mail too big, over $opt_max_mail_size bytes:\t\t";
+ print $mail_too_big;
+ print " (see --max_mail_size=#)\n";
+ }
+ else
+ {
print "";
- $mail_duplicates ?
- print "Reason: duplicate mail, or in db already:\t$mail_duplicates\n" :
+ }
+ if ($mail_duplicates)
+ {
+ print "Reason: duplicate mail, or in db already:\t$mail_duplicates\n";
+ }
+ else
+ {
print "";
- $mail_fixed ?
- print "Reason: mail was an unsubscribe - mail:\t\t$mail_fixed\n" :
+ }
+ if ($mail_fixed)
+ {
+ print "Reason: mail was an unsubscribe - mail:\t\t$mail_fixed\n";
+ }
+ else
+ {
print "";
+ }
print " ";
print "=" . "=" x length("$ignored") . "=\n";
print "Total number of ignored mails:\t\t\t$ignored\n\n";
@@ -187,6 +222,7 @@ sub main
print "% Ignored: ";
print sprintf("%.1f", (($ignored / ($mail_inserted + $ignored)) * 100));
print "%)\n";
+ print "################################ End Report ##################################\n";
exit(0);
}
@@ -291,7 +327,7 @@ sub process_mail_file
$values{$type} .= "\n" . $_;
$check--;
}
- elsif (/^From .* \d\d:\d\d:\d\d\s\d\d\d\d$/ ||
+ elsif (/^From .* \d\d:\d\d:\d\d\s\d\d\d\d/ ||
/^From .* \d\d\d\d\s\d\d:\d\d:\d\d/)
{
$values{'hash'} = checksum("$values{'message'}");