Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Send confirmation email to site visitor????????

Status
Not open for further replies.

kickinpretty

Technical User
Jul 26, 2002
17
GB
Hi all...

i have a cgi script which stores variables from a web form in a text.file i would like also to send a confirmation email to the person who submitted the form. my cgi is like this...

#!\Perl\bin\perl

require "subparseform.lib";
&Parse_Form;

$pw = $formdata{'pw'};
$an = $formdata{'an'};
$un = $formdata{'un'};
$v1 = $formdata{'v1'};
$v2 = $formdata{'v2'};
$v3 = $formdata{'v3'};
$v4 = $formdata{'v4'};
$v5 = $formdata{'v5'};
$v6 = $formdata{'v6'};
$v7 = $formdata{'v7'};
$v8 = $formdata{'v8'};
$v9 = $formdata{'v9'};
$v10 = $formdata{'v10'};
$v11 = $formdata{'v11'};
$v12 = $formdata{'v12'};
$v13 = $formdata{'v13'};
$v14 = $formdata{'v14'};
$v15 = $formdata{'v15'};

@New = ("status=sucessfull
login&upw=$pw&uan=$an&uun=$un&l1=$v1&l2=$v2&l3=$v3&l4=$v4&l5
=$v5&l6=$v6&l7=$v7&l8=$v8&l9=$v9&l10=$v10&l11=$v11&l12=$v12&
l13=$v13&l14=$v14&l15=$v15");

open (LOG, ">/$an$pw.txt") || &ErrorMessage;
print LOG "@New";
close (LOG);


print "Content-type: text/html\n\n";
print "status=Success";

sub ErrorMessage {
print "Content-type: text/html\n\n";
print "status=failed - please try again!";
exit;
}


the email variable is v1, what do i need to add to the script to send email, and do i need to install a mail server...im running win98se/outlook express/apache

any help much appreciated:)
 
Here is a brief example of using the Mail::Sender module to send an email.

Code:
#!perl -w
use Mail::Sender;
use strict;
my $mail_text = qq(Text to go in email body.);

my $mail_server = 'your.mail.server.com';

eval {
    (new Mail::Sender)
    ->MailMsg({smtp => "$mail_server",
        from => 'someone@your.mail.server.com',
        to =>'someone@your.mail.server.com',
        subject => 'this is a test',
        msg => "$mail_text"})
}
or die "$Mail::Sender::Error\n";
'hope this helps

If you are new to Tek-Tips, please use descriptive titles, check the FAQs, and beware the evil typo.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top