Here's the code:1001du.txt Content-Transfer-Encoding: binary Content-Type: multipart/mixed; boundary="boundary-144416012012" MIME-Version: 1.0 Date: 144416012012 From: sking@mortgage-pros.com To: admin@mortgagerefinancingpros.com Subject: New loan request in database (extra fields) This is a multi-part message in MIME format. --boundary-144416012012 Content-Disposition: inline Content-Length: 271 Content-Transfer-Encoding: binary Content-Type: text/plain Dear Member, Please find attached to this email message a loan application file fro +m a recent loan applicant. Be sure to save this DU 3.2 file to your +hard drive and import the data into your loan processing program. Regards, Site Administration Mortgage-pros.com --boundary-144416012012 Content-Disposition: inline; filename="1001du.txt" Content-Transfer-Encoding: base64 Content-Type: application/zip; name="1001du.txt" MTAwMWR1LnR4dA== --boundary-144416012012--
sub sendfile { my $email = $_[0]; my $from = $_[1]; my $subject = $_[2]; my $message = $_[3]; my $file = $_[4]; ($date,$boundary) = &boundary; #print "Content-type: text/html\n\n"; #print $_[4]; #exit; my $file_cont=encode_base64($file); #my $file_cont=encode_base64($line); $length=length($message); $send = qq~Content-Transfer-Encoding: binary Content-Type: multipart/mixed; boundary="$boundary" MIME-Version: 1.0 Date: $date From: $from To: $email Subject: $subject This is a multi-part message in MIME format. --$boundary Content-Disposition: inline Content-Length: $length Content-Transfer-Encoding: binary Content-Type: text/plain $message --$boundary Content-Disposition: inline; filename="$file" Content-Transfer-Encoding: base64 Content-Type: application/zip; name="$file" $file_cont --$boundary-- ~; $smtp = Net::SMTP->new($mailhost); $smtp->mail($_[1]); $smtp->to($_[0]); $smtp->data(); $smtp->datasend("To: $_[0]\n"); $smtp->datasend("From: $_[1]\n"); $smtp->datasend("Subject: $_[2]\n\n"); $smtp->datasend("\n"); #$smtp->datasend("$_[3]\n"); $smtp->datasend("$_[4]\n"); $smtp->datasend("$send\n"); $smtp->dataend(); $smtp->quit; # open(MAIL,"|$mailprog -t"); # print MAIL $send; # close(MAIL); }
In reply to mail script with attachment by zlinkexchange
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |