Francisco Valladolid wrote:
This is the script:

#!/usr/bin/perl -w
use strict;
use CGI qw/:standard/;

require Mail::Send;

my ($msg, $fh, $body, $mail_to);

my $body =<<HTML;
bla bla bla
HTML

print header,
      start_html('Confirmacion:');

# param via Cgi.pm
$mail_to = param('email');

$msg = Mail::Send->new;
$msg = Mail::Send->new(Subject=>'subject');
$msg->to($mail_to);
$msg->cc('[EMAIL PROTECTED]');

$fh = $msg->open;               # some default mailer

print $fh "$body";

$fh->close;         # complete the message and send it

print end_html;

The above script worked for me. However, I rewrote it to help you find out why it doesn't work for you.

#!/usr/bin/perl
use strict;
use warnings;                # see perllexwarn
use CGI qw/:standard/;
use CGI::Carp qw/fatalsToBrowser warningsToBrowser/;

require Mail::Send;

my $body = <<HTML;
bla bla bla
HTML

print header;
warningsToBrowser(1);
print start_html('Confirmacion:');

# param via Cgi.pm
my $mail_to = param('email');

my $msg = Mail::Send->new(Subject=>'subject');
$msg->to($mail_to);
$msg->cc('[EMAIL PROTECTED]');

my $fh = $msg->open or die "Couldn't open mailer: $!";
print $fh $body;
$fh->close or die "Completion failed: $!";

print end_html;

__END__

--
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/


Reply via email to