Streetdaddy
Programmer
Im using a formmail script to send pdf documents from a form. The user selects the file to send, then it is supposed to send the file as an attachment.<br><br>The problem is, that it sends the file as (i think) MIME encoded text. I want it to send the file as an attachment.<br><br>Here is the send mail function from the script:<br><br>sub send_mail {<br> if ($form_letter ne ""
{<br> push (@files,$form_letter);<br> }<br> foreach $file (@files) {<br> if (-e "$filebase/$file"
{<br> open(MAIL,"¦$mailprog -t"
;<br> <br> print MAIL "To: $email ($realname)\n";<br> print MAIL "From: $fromaddr ($fromname)\n";<br> if ($organization) {<br> print MAIL "Organization: $organization\n";<br> }<br> else {<br> print MAIL "Organization: Auto sent file\n";<br> }<br> print MAIL "Subject: $file\n";<br> print MAIL "X-Courtesy-Of: SendIt! 1.0\n\n";<br> open(INPUT,"$filebase/$file"
¦¦&error;<br> while (<INPUT>
{<br> print MAIL "From: $fromaddr ($fromname)\n";<br> if ($organization) {<br> print MAIL "Organization: $organization\n";<br> }<br> else {<br> print MAIL "Organization: Auto sent file\n";<br> }<br> print MAIL "Subject: $file\n";<br> print MAIL "X-Courtesy-Of: SendIt! 1.0\n\n";<br><br>* this is the bit which 'attaches' the file. But it opens it for INPUT and writes it line by line I think...*<br><br> open(INPUT,"$filebase/$file"
¦¦&error;<br> while (<INPUT>
{<br> chop $_;<br> print MAIL $_,"\n";<br> }<br> close (INPUT);<br>*How can I make it attach the file, not write it?*<br><br> close (MAIL);<br> }<br> else {<br> print "Content-type: text/html\n\n";<br> print "<head><title>Sorry</title></head>\n";<br> print "<body bgcolor=ffffff><center><h1>Sorry</h1></center>\n";<br> print "Sorry, your request for files could not be completed\n";<br> print "because at least one of the files was not available.<p>\n"... blah blah blah etc.<br>