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:
MIME Lite

 



patk
Deleted

Aug 3, 2000, 10:41 AM

Post #1 of 3 (354 views)
MIME Lite Can't Post

I'm trying to make a script run
that will allow someone to attach
a file (any file) to an email.
I have MIME Lite installed and I can do this:
#!/bin/perl
$|++;
use MIME::Lite;
$msg = new MIME::Lite
From =>'patk@self-made-man.com',
To =>'patk@perlguru.com',
Cc =>'self-made-man@self-made-man.com, some1@self-made-man.com',
Subject =>'Sub',
Type =>'multipart/mixed';
attach $msg
Type =>'TEXT',
Data =>"Here's the GIF file you wanted";
attach $msg
Type =>'image/gif',
Path =>'2.gif',
Filename =>'2.gif';
$mailprog ="/usr/lib/sendmail";
open(MAIL, "| $mailprog -t ");
$msg->print(\*MAIL);
close(MAIL);

that works, and so does this upload script:

$allowall = "yes";
$theext = ".gif";
$donepage = $ENV{'HTTP_REFERER'};
use CGI;
$onnum = 1;
while ($onnum != 11) {
my $req = new CGI;
my $file = $req->param("FILE$onnum");
if ($file ne "") {
my $fileName = $file;
$fileName =~ s!^.*(\\|\/)!!;
$newmain = $fileName;
if ($allowall ne "yes") {
if (lc(substr($newmain,length($newmain) - 4,4)) ne $theext){
$filenotgood = "yes"; } }
if ($filenotgood ne "yes") {
open (OUTFILE, ">$basedir/$fileName");
print "$basedir/$fileName<br>";
while (my $bytesread = read($file, my $buffer, 1024)) {
print OUTFILE $buffer; }
close (OUTFILE); } }
$onnum++; }

that works too. But I have no idea how to intergrate them together?

If possible, I would like a user to input
the subject line, to, cc, from, etc.
When I try
$c = $in{'c'};
Cc=>'$c', it will appear as $c and not the data of $c.

So what I'm thinking is something like:

#!/bin/perl
require "cgi-lib.pl";
&ReadParse;
$to = $in{'to'};
$from = $in{'from'};
$subject = $in{'subject'};

&Upload;
&Atach_Send;
sub Upload {
# Upload files to /tmp
}

sub Attach_Send {
# Attach file to email, send email to $to
}

exit;

Thanks for any help!
Pat


Cameron
Deleted

Aug 3, 2000, 7:18 AM

Post #2 of 3 (354 views)
Re: MIME Lite [In reply to] Can't Post

When I try
$c = $in{'c'};
Cc=>'$c', it will appear as $c and not the data of $c.>
--------
Cc=>"$c";


TStanley
Deleted

Aug 7, 2000, 5:02 AM

Post #3 of 3 (354 views)
Re: MIME Lite [In reply to] Can't Post

What you need to do is remove the quotes from it<BR><BR><CODE>
$c=in{c};
Cc=$c;
</CODE>

 
 


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

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