3 # Process and import for mail SIDC Ursagrams
5 # This program takes a mail message on its standard input
6 # and, if it is an URSIGRAM, imports it into the local
9 # Copyright (c) Dirk Koopman G1TLH
18 my $import = '/spider/msg/import';
20 my $msg = Mail::Internet->new(\*STDIN) or die "Mail::Internet $!";
21 my $head = $msg->head->header_hashref;
23 if ($head && $head->{From}->[0] =~ /sidc/i && $head->{Subject}->[0] =~ /Ursigram/i) {
24 my $body = $msg->body;
25 my $title = 'SIDC Ursigram';
27 foreach my $l (@$body) {
28 if ($l =~ /SIDC\s+SOLAR\s+BULLETIN\s+(\d+)\s+(\w+)\s+20(\d\d)/) {
34 open OUT, ">$import/ursigram$date.txt" or die "import $!";
35 print OUT "SB ALL\n$title\n";
36 print OUT map {s/\r\n$/\n/; $_} @$body;