]> git.pld-linux.org Git - projects/distfiles.git/commitdiff
Send report mails separately to requester and list
authorJan Rękorajski <baggins@pld-linux.org>
Sat, 18 Oct 2014 13:05:22 +0000 (15:05 +0200)
committerJan Rękorajski <baggins@pld-linux.org>
Sat, 18 Oct 2014 13:05:22 +0000 (15:05 +0200)
"Some" mail providers do deduplication solely based on the
message-id, thus making mail sent to list and requester show
only once if requester is subscribed to list.
By sending two mails with different message-id we can work
around this.

file-fetcher.pl
request-handler.pl

index 09cdfaa42eb1413b5104d322223d012ac9f46aee..78aecf00634c43ab3ffad941886b902f3c5d041f 100755 (executable)
@@ -358,9 +358,6 @@ sub fetch_files()
 
 sub send_email()
 {
-  syslog("info","sending email to $requester");
-  open(EMAIL, "| /usr/sbin/sendmail -t");
-  #open(EMAIL, "| cat");
   my $marker = "";
   if ($problems ne "") {
     $marker = "ERRORS: ";
@@ -371,16 +368,14 @@ sub send_email()
   splice(@files, 10, @files - 10, "...")
     if (@files > 10);
 
-  print EMAIL
+  my $message_id = 
+  my $email_head =
 "From: $req_login <$requester>
-To: $commits_list
-Cc: $requester
 Subject: DISTFILES: ${spec}: ${marker}@{files}
-Message-ID: <$$." . time . "\@distfiles.pld-linux.org>
 X-distfiles-program: file-fetcher.pl
-X-distfiles-version: " . '$Id$' . "
-
-$problems
+";
+  my $email_body =
+"$problems
 Files fetched: $fetched_count
 
 $normal_out
@@ -388,6 +383,33 @@ $normal_out
 -- 
 Virtually Yours: distfiles.
 ";
+
+  syslog("info","sending email to $requester");
+  open(EMAIL, "| /usr/sbin/sendmail -t");
+  #open(EMAIL, "| cat");
+
+  print EMAIL
+"To: $requester
+$email_head
+Message-ID: <$$." . time . "\@distfiles.pld-linux.org>
+
+$email_body";
+
+  close(EMAIL) or fatal("close() failed");
+
+  syslog("info","sending email to $commits_list");
+  open(EMAIL, "| /usr/sbin/sendmail -t");
+  #open(EMAIL, "| cat");
+
+  print EMAIL
+"To: $commits_list
+$email_head
+Message-ID: <$$." . time . "\@distfiles.pld-linux.org>
+
+Request by: $requester
+
+$email_body";
+
   close(EMAIL) or fatal("close() failed");
 }
 
index 347233e9b5b2e7ef1b80e27a7171bc5c24cfb97b..dfcd273d1036cdcab4ce495f3e8a6983aa2a0c06 100755 (executable)
@@ -29,24 +29,37 @@ sub report_fatal($)
 
   syslog("err","FATAL: $msg");
   cleanup();
-  open(M, "| /usr/sbin/sendmail -t") or die("/usr/sbin/sendmail not found");
-  #open(M, "| cat") or die;
-  my $version = '$Id$';
-  print M <<EOF
-From: $from <$from\@pld-linux.org>
-To: $commits_list
-Cc: $from\@pld-linux.org
-Message-ID: <$id\@distfiles.pld-linux.org>
+
+  my $email_head =
+"From: $from <$from\@pld-linux.org>
 Subject: DISTFILES: ERROR fetching sources for $spec ($branch)
 X-distfiles-program: request-handler.pl
-X-distfiles-version: $version
-
-$msg
+";
+  my $email_body =
+"$msg
 
 -- 
 Virtually Yours: distfiles.
-EOF
-;
+";
+
+  open(M, "| /usr/sbin/sendmail -t") or die("/usr/sbin/sendmail not found");
+  #open(M, "| cat") or die;
+  print M
+"To: $commits_list
+$email_head
+Message-ID: <$$." . time . "$id\@distfiles.pld-linux.org>
+
+$email_body";
+  close(M) or die("problem while sending email");
+  
+  open(M, "| /usr/sbin/sendmail -t") or die("/usr/sbin/sendmail not found");
+  #open(M, "| cat") or die;
+  print M
+"To: <$from\@pld-linux.org>
+$email_head
+Message-ID: <$$." . time . "$id\@distfiles.pld-linux.org>
+
+$email_body";
   close(M) or die("problem while sending email");
   exit 0;
 }
This page took 0.097064 seconds and 4 git commands to generate.