Merhabalar,

Hylafax'ı Qmail ile mail to fax gateway olarak kullanmak için
http://sourceforge.net/projects/qmail2hylafax/ adresinde bulunan Perl ile
yazılmış uygulamayı kullanmak istiyorum. Script içeriği şöyle;

#!/usr/bin/perl
#
#  name: gateway-qmail2fax.pl
#  rev   : 2.0
#  date  : 10-05-2003
#  Lic.  : GPL
#  Author: mcmax(c) ESS Srl -Vi - italy
#  URL   : http://www.mcmax.info/qmailaddon
#  Email : [email protected]
#  Note:
#     see README INSTALL PACKAGE Qmail maildrop  vpopmail
#         connect documentation
#
#  History:
#         Update with pdftops [10-11-2006] 2.0 Stable version
#     Base version[17-07-2004] 1.1 Stable version
#     Base version[10-05-2003] 1.0a
#
#  Feature:
#     Se TODO List
#
#
$locpath = "./";
$nomehost = "fax.esssrl.it";
$data = time();

$fout = "$locpath$data.$$.$nomehost";
#
#-----------solution to problem of secuity----------mcmax 04/2005-SuSE---
#
$path = $ENV{'PATH'};                   # $path now tainted

$ENV{'PATH'} = '/bin:/usr/bin';
delete @ENV{'IFS', 'CDPATH', 'ENV', 'BASH_ENV'};

$path = $ENV{'PATH'};                   # $path now NOT tainted

#system "cat $_ > ./lastfax";
system "cat $_ > $fout";                # security action on system
system "cp $fout ./lastfax";            #  copi di manipolazione dati

#
# extract number fax
#
system "cat $fout | /usr/local/bin/reformail -x to: > ./numfax";
#
#  extraxt attach infomation (position 1.2 normal il first PDF attachment)
#
system "cat $fout | /usr/local/bin/reformime -i > ./faxinfo";
#
# extract PDF document into local file
#
system "cat $fout | /usr/local/bin/reformime -e -s 1.2 > ./filePDF";
#
#  convert PDF on PS format with pdftops for correct size  (update to rev
2.0)
#
system "pdftops ./filePDF";
#
#  read number fax and clear from unused char
#  from <fax-0444-778...@fax>
#  to clear: 0444-778...@fax
#
$numtel = `cat $fout | /usr/local/bin/reformail -x to:`;
$numtel =~ s/<fax-/ /gi;
$numtel =~ s/\...@fax>/ /gi;
#
# Send document to HylaFax Server
#
system "/usr/bin/sendfax -v -n -t 6 -s a4 ./filePDF.ps -d $numtel 2>&1 >
/dev/null";
#
#  remove old file if need
#
system "rm $fout";

Script basitçe standart girişten emaili alıp işliyor. Sorun yaşadığım kısım;

$numtel = `cat $fout | /usr/local/bin/reformail -x to:`;
$numtel =~ s/\...@fax/ /;

Standart girişten alınan mailin headerından reformail ile to kısmı
alınıyor ki bu değer 4445...@fax gibi bir değer. Yani
telefon_numar...@domain yapısında bir değer geliyor. Benim yapmak
istediğim @fax kısmını bu değerden çıkarıp kalan kısım olan 4445566 yani
telefon numarasını $numtel değişkenine aktarmak. Yukarıdaki kodu
kullandığımda ne yazık ki sonuca ulaşamıyorum. Perl versiyonum
perl-5.10.1_1. Nerede hata yapıyorum acaba?

Saygılarımla..

_______________________________________________
Linux-programlama mailing list
[email protected]
https://liste.linux.org.tr/mailman/listinfo/linux-programlama
Liste kurallari: http://liste.linux.org.tr/kurallar.php

Cevap