File tree Expand file tree Collapse file tree 1 file changed +15
-10
lines changed Expand file tree Collapse file tree 1 file changed +15
-10
lines changed Original file line number Diff line number Diff line change @@ -950,17 +950,22 @@ sub install_or_remove_crontab {
950
950
open CRON, $tmp_crontab or die " can't open $tmp_crontab : $! " ;
951
951
while (<CRON>) {
952
952
if (/ ^MAILTO=(.*)$ / ) {
953
- system (" /data/mysociety/bin/lookup_google_apps_email.sh $1 " );
954
- my $result = $? >> 8;
955
- if ($result == 1) {
956
- unlink $tmp_crontab ;
957
- die " MAILTO=$1 : not a valid address in crontab" ;
958
- } elsif ($result == 2) {
959
- warn " Google Apps API not working; can't check MAILTO address" ;
960
- } elsif ($result != 0) {
961
- warn " unexpected result code $result from lookup_google_apps_email.sh" ;
953
+ my $found_external ;
954
+ foreach my $mailto (split (' ,' , $1 )) {
955
+ next if $mailto =~ / \@ ${hostname} / ;
956
+ $found_external = 1;
957
+ system (" /data/mysociety/bin/lookup_google_apps_email.sh $mailto " );
958
+ my $result = $? >> 8;
959
+ if ($result == 1) {
960
+ unlink $tmp_crontab ;
961
+ die " MAILTO=$mailto : not a valid address in crontab" ;
962
+ } elsif ($result == 2) {
963
+ warn " Google Apps API not working; can't check MAILTO address" ;
964
+ } elsif ($result != 0) {
965
+ warn " unexpected result code $result from lookup_google_apps_email.sh" ;
966
+ }
962
967
}
963
-
968
+ warn " No external email found in MAILTO " unless ( $found_external );
964
969
last ;
965
970
}
966
971
}
You can’t perform that action at this time.
0 commit comments