CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
Search Posts SEARCH
Who's Online WHO'S
Log in LOG

Home: Perl Programming Help: Beginner:
email Attachment without LITE



Apr 16, 2002, 4:55 AM

Post #1 of 3 (1332 views)
email Attachment without LITE Can't Post

Unsure I would like to know how to attach a file to an email without using any libraries (like LITE). I want to use only sendmail. Below is my CGI code. The code works for everything except the attachment. What am I doing wrong? Or is it impossible to attach a file file without using LITE. (My commercial webserver doesn't support LITE right now (Concentric) and I don't know how to install LITE onto Concentric's server.)


open MAIL, "$mailprogram";

print MAIL "To: $recip\n";
print MAIL "From: $from_addr\n";
print MAIL "Subject: $subject\n";

print MAIL "Content-Type: multipart/mixed; boundary=boundarystring\n";

print MAIL "--boundarystring\n";
print MAIL "Content-type: text/html\n";
print MAIL $message;

print MAIL "--boundarystring\n";
print MAIL "Content-Type: application/msword\n";
print MAIL "Content-Transfer-Encoding: base64\n";
print MAIL "Content-Disposition: attachment; filename='TheWordDoc.Doc'";
print MAIL $FORM{$WordDoc}; // this is an input type=file field

print MAIL "--boundarystring--";

close MAIL;

Thanks in advance. Peter.


Apr 16, 2002, 8:22 AM

Post #2 of 3 (1329 views)
Re: [zeno] email Attachment without LITE [In reply to] Can't Post


You may wish to read here:;search_string=boundary;#143369

You will need MIME::Base64 but your host should have that.


Apr 18, 2002, 4:38 AM

Post #3 of 3 (1323 views)
Re: [RedRum] No MIME access!!! [In reply to] Can't Post

Dear Paul: Smile Thanks for the response. That was really helpful. I know how to attach files - But Unsure ... My host doesn't support In other words, the multipart attachment procedure now works fine but only for text files not if I try to attach a word document. There seems to be several reasons why it is failing:

1 - My host doesn't accept the use MIME::Base64 qw(encode_base64); command. In fact, it doesn't support any "use MIME" statement.

2 - Any other effort at sending a word document results in a corrupt word doc - because spaces and other characters are being removed or changed.

Here's my question (which I believe has 4 requirements): Any suggestions on how to (1) transmit a word document (2) as an attachment (3) using only the standard "use CGI" (4) in a multipart email?

Thanks agains. Peter.


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives