Hello,
I'm using maildrop to support this, this the maildroprc file inside.
LOGDIR="/var/log"
logfile "$LOGDIR/maildroprc.log"
cc $DEFAULT
to "|/usr/sbin/parsing.pl"
and this is the parsing.pl file inside..
#!/usr/bin/perl
use Shell;
#use strict;
use Mail::Internet;
use String::Rexx qw( :all );
use HTTP::Lite;
my $http = new HTTP::Lite;
#ambil header
my $header = Mail::Internet->new(*STDIN)->head()->header_hashref();
chomp $header->{$_}[0] foreach keys(%{$header});
#ambil subject,from,to daro header
my $subject = $header->{Subject}[0];
my $from = $header->{From}[0];
my $to = $header->{To}[0];
#ganti karakter2x yang tidak benar step 1
my $from1 = changestr('@',changestr('"',$from,'\"'),'\@');
my $to1 = changestr('@',changestr('"',$to,'\"'),'\@');
#ganti karakter2x yang tidak benar step 2
my $dari = bersihkan($from1);
my $ke = bersihkan($to1);
my $req =
$http->request("http://10.1.1.2:8080/am13/mailNotif?from=$dari&to=$ke") or
die "Unable to open connection to sms notify: $!";
sub bersihkan {
if ($_[$from] =~ m/(.+)\s\<(.+)\@(.+)\>/) {
my $from =~ m/(.+)\s\<(.+)\@(.+)\>/;
my $panjang = length($2."\@".$3);
my $from = substr($2."\@".$3, 0);
} else {
my $from = $_[$from];
}
};
exit 0;
cheers
Fajar
_____
From: Joyce Gutierrez [mailto:[EMAIL PROTECTED]
Sent: Wednesday, September 10, 2008 9:39 AM
To: Kannel users
Subject: Mail to SMS with Kannel
Hi guys,
I can now send SMS to phones with kannel. Now I am trying to integrate
Kannel with Postfix in a way that whenever a new message arrives at the
inbox it would be forwarded to the intended receivers to their mobile
phones....
I have read some posts about this, and have tried using procmail and a perl
script to parse the email and forward it to my /cgi-bin/sendsms,,
here is my .procmailrc
TO=`formail -xTo:`
SUBJECT=`formail -xSubject: \
| expand | sed -e 's/^[ ]*//g' -e 's/[ ]*$//g'`
SENDER=`formail -xFrom: \
| expand | sed -e 's/^[ ]*//g' -e 's/[ ]*$//g'`
BODY= `formail -I "" \
| expand | sed -e '1,/^$/ d' -e '1,/^$/ d'`
BODY=`formail -I "" `
SENDER=`formail -rtzxTo:`
:0
| perl /home/sms/massms/newsms.pl $SENDER $TO $SUBJECT $BODY >>
/home/sms/massms/maillog.txt
Unfortunately, whenever I test sending an email, the mail is just received
by the procmail and nothing happens anymore,, The log I specified in
.procmailrc just remains to be empty,
Could there be any other way to implement Mail to SMS? Or couold any body
point ut what possibly is my problem?
I hope somebody could help me,
Thanks in advance
Joyce