#!/usr/bin/perl #------------------------------------------------------------------- # faxer.pl # # Send file to . Note that the recipient field is # a specially formatted field that contains recipient name, fax #, # and email address of the fax server, like so: # # "/name=Lonnie Phillips/fax=5551234/" # # 20050111 Roboticus - Added comments, some error checking # ???????? LPhillips - originally written #------------------------------------------------------------------- use strict; use MIME::Lite; MIME::Lite->send('smtp','mail.your.domain',Timeout=>60); use Net::SMTP; my $smtp = Net::SMTP->new('mail.your.domain', Debug=>1); print $smtp->domain,"\n"; my $usage= 'usage: faxer.pl where: = Fax address, formatted like: "/name=Roboticus/fax=5551234/" '; #my $fax_dest = @ARGV[0] or die $usage . "\nmissing "; my $msg = MIME::Lite->new( To => '/name=%fromName%/fax=%toFax%/', From => 'MailBot@your.domain', Subject => 'Roboticus\'s test fax', Type => 'multipart/related', ) or die "Error creating MIME container!\n"; $msg->attach( Type => 'text/html', Data => qq {

%fromName%
TOFROM
Name:%toName%Name:
Fax:%toFax%Fax:% fromFax%
Phone:%fromPhone%
EMail:%fromEMail%

To Whom It May Concern,

Regional Security is currently conducting a review on merchant %MerchID% "%MerchName%" for a batch of \$%MerchBatch%.

All funds are on hold until the review is complete. If you have any questions or information, please feel free to contact me at %fromPhone% or email me at %fromEMail%.

Thank You,

%fromName% }, ) or die "Error creating HTML!\n"; $msg->attach( Type => 'image/gif', Id => 'ltrhead.gif', Path => 'fake_letterhead.gif', ) or die "Error adding image!\n"; open(OUTF,">faxer.mht") or die "Can't open output file"; print OUTF $msg->as_string; close(OUTF); $smtp->mail('mmason@npc.net'); ##$smtp->to('/name=Roboticus/fax=5551234/'); $smtp->to('roboticus@your.domain'); $smtp->data(); $smtp->datasend($msg->as_string); $smtp->dataend(); $smtp->quit();