|
This is a short description on how you can easily send faxes from your linux box through the mail2fax gateway faxaway.com.
Once you've subscribed with faxaway.com, you can send faxes by sending an email to e.g. "49123433223@faxaway.com", where "49" is the country code, and the rest is the remaining part of the target fax number. Faxaway accepts a given set of "From:" addresses that are allowed to send faxes through your account. The document that you want to fax needs to be attached; I've got good results with PDFs that I scan in as described here. The subject line must read "FAXDOC", one single word, no quotes.
Now the idea is to use Kdeprintfax in order to send these faxes. Actually, kdeprintfax is just a nice user interface that will pipe the fax to the Perl script given below. Kdeprintfax integrates with the Kde address book, so you can store your fax numbers there. For Kdeprintfax to work as expected, you have to do some small settings in the configuration screen:
a) Under "System", you have to set "Other" as "Fax-System" and as command you write /pgm/scripts/print2fax %files %number if you are going to put the perl script in this location.
b) Under "Filters", add a filter for the Mime-Type "application/pdf" with cp %in %out as command.
If you have problems, the log file will be of help. The following script works for only one document and one number at a time, yet that's the only thing that faxaway supports anyway:
#!/usr/bin/perl
#
# This script faxes via faxaway.com
#
use strict;
use File::Temp;
my ($pdffile, $number) = @ARGV;
my $ownaddress = "yourname\@yourserver.org";
my $mail2faxgw = "$number\@faxaway.com";
my $tmpdir = "/tmp";
my $tmpfile = new File::Temp( TEMPLATE => 'tempXXXXX', DIR => $tmpdir, SUFFIX => '.pdf');
system("cp \"$pdffile\" \"$tmpfile\"");
system("export EMAIL=$ownaddress && mutt -a \"$tmpfile\" -s FAXDOC $mail2faxgw </dev/null");
For this to work, I had to add the following line to my ~/.muttrc:
Alternatively, if you rather like to just right-click on a file and send it via fax and you do not like a thick user interface like Kdeprintfax, you can do something like:
#!/usr/bin/perl
#
# This script faxes via faxaway.com
#
use strict;
use File::Temp;
my ($pdffile) = join(" ", @ARGV);
my $number = "";
chop ($number .= `kdialog --title "XFax" --inputbox "Enter the target number: "` );
if($number eq "") { exit; }
my $ownaddress = "yourname\@yourserver.org";
my $mail2faxgw = "$number\@faxaway.com";
my $tmpdir = "/tmp";
my $tmpfile = new File::Temp( TEMPLATE => 'tempXXXXX', DIR => $tmpdir, SUFFIX => '.pdf');
system("cp \"$pdffile\" \"$tmpfile\"");
system("export EMAIL=$ownaddress && mutt -a \"$tmpfile\" -s FAXDOC $mail2faxgw </dev/null");
|