miredo
asked on
script isn't sending email to me
#!/usr/bin/perl -w
print "Content-type: text/html\n\n";
use CGI qw(:standard);
open(MAIL, "|/usr/sbin/sendmail -oi -t") or die "can't do sendmail: $!";
print MAIL <<eof;
From: mysite.com
To: me@ix.netcom.com
Subject: Someone submitted information via your form
[form info here]
eof
save_parameters(*MAIL);
close(MAIL) or die "can't close sendmail: $!";
print <<VERIFY;
Email sent.
VERIFY
*********************
I'm seeing "Email sent" in the browser, but I'm receiving no email. No error messages. I think I should see
From: mysite.com
To: me@ix.netcom.com
Subject: Someone submitted information via your form
[form info here]
print "Content-type: text/html\n\n";
use CGI qw(:standard);
open(MAIL, "|/usr/sbin/sendmail -oi -t") or die "can't do sendmail: $!";
print MAIL <<eof;
From: mysite.com
To: me@ix.netcom.com
Subject: Someone submitted information via your form
[form info here]
eof
save_parameters(*MAIL);
close(MAIL) or die "can't close sendmail: $!";
print <<VERIFY;
Email sent.
VERIFY
*********************
I'm seeing "Email sent" in the browser, but I'm receiving no email. No error messages. I think I should see
From: mysite.com
To: me@ix.netcom.com
Subject: Someone submitted information via your form
[form info here]
Does your server have Sendmail??
ASKER
Yes, on my account page, my host posts the path to sendmail:
/usr/sbin/sendmail
/usr/sbin/sendmail
Maybe the "-oi" should be "-i" in your sendmail call...
Other than this you can also use the MIME::Tools module like this:
---
use MIME::Entity;
my $address_string = 'me@ix.netcom.com';
my $recipient_address = 'you@is.netcom.com';
# mysite.com is no valid email address !
my $data_string = <<eof;
[form info here]
eof
my $mail = MIME::Entity->build(
'Encoding' => 'quoted-printable',
'From' => $address_string,
'To' => [ $recipient_address ],
'Subject' => "Whatever your subject is",
'Data' => $data_string
);
open MAIL, "| /usr/sbin/sendmail -t -i" or die "open: $!";
$top->head->fold;
$top->print(\*MAIL);
close MAIL;
Hope that helps...Andy
Other than this you can also use the MIME::Tools module like this:
---
use MIME::Entity;
my $address_string = 'me@ix.netcom.com';
my $recipient_address = 'you@is.netcom.com';
# mysite.com is no valid email address !
my $data_string = <<eof;
[form info here]
eof
my $mail = MIME::Entity->build(
'Encoding' => 'quoted-printable',
'From' => $address_string,
'To' => [ $recipient_address ],
'Subject' => "Whatever your subject is",
'Data' => $data_string
);
open MAIL, "| /usr/sbin/sendmail -t -i" or die "open: $!";
$top->head->fold;
$top->print(\*MAIL);
close MAIL;
Hope that helps...Andy
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Have you been helped here or is more needed?
Moondancer - EE Moderator
Moondancer - EE Moderator