
darian
Deleted
Mar 28, 2000, 4:35 AM
Post #3 of 4
(403 views)
|
Ok here is something I threw together that might lead you in the right direction. <BLOCKQUOTE><font size="1" face="Arial,Helvetica,sans serif">code:</font><HR> #!/usr/local/bin/perl use CGI qw(:cgi); use CGI::Carp qw(fatalsToBrowser); $in = new CGI; $subject = 'Check this out!'; #What you want to put in the subject line. $file = '/path/to/the/files/'; #path to where the text files are. $url = 'http://url/to/the/files/'; #url to the directory where the text files are. $link = 1; #1 to just send a link, 0 to send the file. $return = 'http://url/back/to/your/page/'; $file.= $in->param('file'); $toname = $in->param('toname'); $toemail = $in->param('toemail'); $fromname = $in->param('fromname'); $fromemail = $in->param('fromemail'); open(MAIL, "|$mailprog -t") or die("$!"); print MAIL "To: $toname <$toemail>\n"; print MAIL "From: $fromname <$fromemail>\n"; print MAIL "Subject: $subject\n\n"; print MAIL "This mail was sent to you because, $toname, though you might like it.\n"; print MAIL "This mail was sent to using WEBMailer v1.0 created by Stanley Glass Jr\n"; print MAIL "of <a href=http://www.glass-images.com>Glass Images</a>.\n"; print MAIL "======================================================================\n\n"; if($link) { print MAIL "Click on the link below or type the url into your browser to see this\n"; print MAIL "great page.\n\n" print MAIL "$url\n"; } else { open(FILE, "$file") or die("$!"); while (<FILE> ) { print MAIL "$!"; } } close(MAIL); print "Location: $return \n\n";</pre><HR></BLOCKQUOTE> Now you just have to add a few lines to your page where you want to have the form. <BLOCKQUOTE><font size="1" face="Arial,Helvetica,sans serif">code:</font><HR> <form action=send.cgi method=post> <input type="hidden" name="file" value="myfile.txt"> TO:<br> Name:<input type="text" name="toname"><br> Email:<input type="text" name="toemail"><br> From:<br> Name:<input type="text" name="fromname"><br> Email:<input type="text" name="fromemail"><br> <input type="submit" value="Send"> </form></pre><HR></BLOCKQUOTE> You can go more extravagent but hey I just threw this one together. Havn't tested it yet either. Hope this helps you.
|