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

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Perl Programming Help: Beginner:
File attachments.

 



feljuri
Deleted

Apr 26, 2000, 7:34 AM

Post #1 of 7 (1003 views)
File attachments. Can't Post

Can I attach a file to an email, without using modules?

Thanks.
Frank


Cure
User

Apr 25, 2000, 10:14 PM

Post #2 of 7 (1003 views)
Re: File attachments. [In reply to] Can't Post

Hi

yes, You can do file attachment(s) without using a module--> but why would you want to?

The module does all the dirty work for you.

The module that does file attachment(s)-> MIME::Lite


Cure


feljuri
Deleted

Apr 25, 2000, 10:51 PM

Post #3 of 7 (1003 views)
Re: File attachments. [In reply to] Can't Post

I cant install modules because I only have access to my cgi-bin directoty.
If there any possibilities to use them?


This is the way that I send the emails,
Can I insert a file attachment in this code:

sub send_mail {
open(MAIL,"|$mailprog -t");
print MAIL "To: you\@domain.com\n";
print MAIL "From: me\@domain.com\n";
print MAIL "Subject: Test mail\n";
print MAIL "This is the body\n";
close(MAIL);
}

Thanks.


Cure
User

Apr 26, 2000, 11:52 AM

Post #4 of 7 (1003 views)
Re: File attachments. [In reply to] Can't Post

Hi

You can install a moudle--> just upload the module to your cgi-bin directory..

make a directory called MIME in your cgi-bin directory and put your lite.pm module in there

and put this at the top of your script you are using

BEGIN
{
unshift @INC, "path/to/directory/";
}

Cure




RayStreet
Deleted

Apr 26, 2000, 1:54 PM

Post #5 of 7 (1003 views)
Re: File attachments. [In reply to] Can't Post

I can't persuade my ISP to load the modules so how do you do this in standard perl?


feljuri
Deleted

Apr 26, 2000, 10:19 PM

Post #6 of 7 (1003 views)
Re: File attachments. [In reply to] Can't Post

Please tell to us (RayStreet and me) How can we attach a file to an email in basic perl.

Cure, I dont understand so well the module installation procedure.
Its that simple:
1.Make a MIME directoty
2.Upload a lite.pm
3.Put this line:
unshift @INC, "path/to/directory/";

Thanks.


Cure
User

Apr 27, 2000, 11:25 AM

Post #7 of 7 (1003 views)
Re: File attachments. [In reply to] Can't Post

HI

I wrote this for just for yall
Example this will attachment a file to an email, for this example we will attach a cgi script called guestbook.cgi and the can also do html. So whoever gets this email it will say in html format I lover Perl and have a attach file called guestbook.cgi

open(MAIL, "|/usr/sbin/sendmail -t") | | die "Can't open /usr/sbin/sendmail:$!";
print MAIL <<END_OF_MAIL;
To: you\@texas.net
CC: whoever\@texas.net
From: me\@texas.net
Subject: This is a test
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="My-Boundry"
X-Mailer: guestbook.cgi
Status: O

--My-Boundry
Content-type: text/html


<html><body>
<BIG><BIG><B>I Love Perl</BIG></BIG></B>

</body></html>
--My-Boundry
Content-Type: text/plain; name="guestbook.cgi"
Content-Disposition: attachment; filename="guestbook.cgi"


END_OF_MAIL
open FILE,"guestbook.cgi"
or die "Could not open guestbook.cgi:$!";
select MAIL;
while (<FILE> ) {print}
close FILE;
close MAIL;
select STDOUT;

Cure


 
 


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

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