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: Intermediate:
Sending attachments...

 



perlmonkey
Deleted

Mar 7, 2000, 4:38 AM

Post #1 of 4 (664 views)
Sending attachments... Can't Post

I have a simple script which collects username, email and script that they wish to download. The script is mainly just - check the form, email info, done, but I can't get any attachments to send. For that matter when I enable direct download It just prints the location of the file to the end of my thank you screen.

Perplexed.

How do you create an attachment to say:

open (USERMAIL,"|$sendmailpath");
print USERMAIL "From: $adminmail\n";
print USERMAIL "To: $contents{'email'}\n";
print USERMAIL "Subject: $subject\n\n";
print USERMAIL "$thankyou_message\n\n";
close (USERMAIL);

??

Any help is always appreciated.


Cure
User

Mar 6, 2000, 10:19 PM

Post #2 of 4 (664 views)
Re: Sending attachments... [In reply to] Can't Post

Hi

for sending attachemnts I would use the MIME::Lite

Example::


#!/usr/bin/perl


use CGI::Carp qw/fatalsToBrowser/;
use Lite;
$q = new CGI;
print $q->header;

$sendmail = '/usr/sbin/sendmail';
# Create a new multipart message:
$msg = new MIME::Lite
From =>'jondoe@net',
To =>'johndoe@net',
Cc =>'suedoe@net, some@more.com',
Subject =>'A message with 2 parts...',
Type =>'multipart/mixed';

# Add parts (each "attach" has same arguments as "new"):
attach $msg
Type =>'TEXT',
Data =>"hi yall";
attach $msg
Type =>'image/gif',
Path =>'amy.jpg',
Encoding =>'base64',
Filename =>'nice.jpg';

$msg->send;

print "Hi there-> Check your Email!!";


cure


perlmonkey
Deleted

Mar 7, 2000, 1:41 PM

Post #3 of 4 (664 views)
Re: Sending attachments... [In reply to] Can't Post

Thanks cure,

Unfortunately, it looks like my server does not have MIME Tools installed. I thinks I found the same answer to someone else's post and tried it, but my server has a Software Error and says that it can't locate Lite.pm or Mime/Lite.pm.

Am I doing it wrong?

Oh, well. Oh yeah, before I send this post I must mention that everytime I post and half of the time that I am viewing other posts your site crashes Netscape.

It's happened here six times already and I know it's gonna happen after I post. When it gets ready to redirect or when it refreshes the last thing that you see is "Javascript Error:" and that's it. Perhaps it's the cool new menu system. Don't know, thought I'd tell you. Well, here goes nothin'.

Thanks again.


Cure
User

Mar 7, 2000, 3:23 PM

Post #4 of 4 (664 views)
Re: Sending attachments... [In reply to] Can't Post

Hi

Mime::tools is fairly recent so your webserver probobaly wont have that module..

Solution::just download the module(s) and install it on your server then change the path so then perl will know its there.


Put this at the top of your script this will tell perl where to look

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

Example::

#!/usr/bin/perl

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


use CGI::Carp qw/fatalsToBrowser/;
use Lite;
$q = new CGI;
print $q->header;

$sendmail = '/usr/sbin/sendmail';
# Create a new multipart message:
$msg = new MIME::Lite
From =>'jondoe@net',
To =>'johndoe@net',
Cc =>'suedoe@net, some@more.com',
Subject =>'A message with 2 parts...',
Type =>'multipart/mixed';

# Add parts (each "attach" has same arguments as "new"):
attach $msg
Type =>'TEXT',
Data =>"hi yall";
attach $msg
Type =>'image/gif',
Path =>'amy.jpg',
Encoding =>'base64',
Filename =>'nice.jpg';

$msg->send;

print "Hi there-> Check your Email!!";


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