Question:
Perl Problem (please help)?
anonymous
2008-08-19 10:32:38 UTC
I seriously do not have a clue about perl but i need a piece of software which will email a link to the email adresse the user put in using sendmail. I have put together a script which sends the email and one which will store the info to a log file. The script doesn't work and i don't have a clue why. i've included my script below, if you can find possible errors please help me to correct them,
Thanks
Ian
Perl Script
--------------------------------------

#!/usr/bin/perl

use CGI;

# Create the CGI object
my $query = new CGI;

# Output the HTTP header
print $query->header ( );

# Capture the form results
my $senderemail = $query->param("senderemail");
my $sendername = $query->param("sendername");
my $reciplentsemail = $query->param("reciplentsemail");
my $reciplentsname = $query->param("reciplentsname");
my $message = $query->param("message");

$dateandtime = time();

# Email the form results
open ( MAIL, "| /usr/sbin/sendmail -t" );
print MAIL "From: $senderemail\n";
print MAIL "To: $reciplentsemail\n";
print MAIL "Subject: \n";
print MAIL "\n";
print MAIL "\n.\n";
close ( MAIL );

$filename = "Log file location here";
open(FH, ">>$filename");
print FH "$dateandtime | $sendername | $senderemail | $reciplentsname | $reciplentsemail\n";
close(FH);

# Thank the user
print <

You're message has been sucessfully sent. Close this window to continue browsing our site.

END_HTML
Three answers:
Cristiano
2008-08-19 11:09:16 UTC
Check this site: http://www.perlfect.com/articles/sendmail.shtml
martinthurn
2008-08-20 11:22:09 UTC
If you want help, TELL US WHAT ERROR YOU'RE GETTING. Jeez, we aren't mind readers!



Try using the Email::Send module from CPAN.
hands.adrian
2008-08-20 00:58:43 UTC
use Net::SMTP;



http://search.cpan.org/~gbarr/libnet-1.22/Net/SMTP.pm


This content was originally posted on Y! Answers, a Q&A website that shut down in 2021.
Loading...