[ LUGOS ] Internet/Procmail - SMS
Iztok Umek
iztok na ieee.si
Pon Nov 9 12:16:49 CET 1998
Zdravo!
Ker ni bilo nobenega odgovora, sem se resevanja problema lotil sam.
Tukaj pa je resitev.
LP,
Iztok
V .procmailrc
GSMMAIL=$HOME/.gsmmail
:0 c
* ^Subject:.[Ss][Mm][Ss]*
| $GSMMAIL
v .gsmmmail pa je:
#!/opt/perl5/bin/perl
use Mail::Internet;
use Mail::Header;
use Mail::Sendmail;
@mail = <STDIN>;
$gsmemail='xxxxxx na linux.mobitel.si';
$mail = Mail::Internet->new(\@mail);
$subjectGSM = $mail->get('Subject');
chop $subjectGSM;
$subject =~ s/[Sm][Mm][Ss]//e;
$fromGSM = $mail->get('From');
chop $fromGSM;
$mail->remove_sig;
$mail->tidy_body;
$body0=$mail->body->[0];
$body1=$mail->body->[1];
$body2=$mail->body->[2];
%gsmmail = ( Smtp => 'stealth.fri.uni-lj.si',
To => "$gsmemail",
From => "$fromGSM",
Subject => "$subjectGSM",
Message => "$body0\n$body1\n$body2"
);
#sendmail #gsmmail;
if (sendmail %gsmmail) { print "Mail sent OK.\n" }
else { print "Error sending mail: $Mail::Sendmail::error \n" }
print "\n\$Mail::Sendmail::log says:\n", $Mail::Sendmail::log;
--------------------------------------------------------------------------
iztok na ieee.si Sun Certified Network Administrator (SCNA)
http://gea.fri.uni-lj.si/~iztok Sun Certified System Administrator (SCSA)
Snail Mail: Iztok Umek, Pod vinogradi 39, SI-8351 Straza, Slovenia
Dodatne informacije o seznamu Starilist