sendmail- will someone please tell me why this doesnt work...
ive been going over this again and again for hours, someone help!
#!/usr/local/bin/perl
$mailprog="usr/sbin/sendmail";
print "Content Type: text/html\n\n";
print "<h1>testing sendmail</h1>\n";
&send_mail;
sub send_mail {
open(MAIL,"|$mailprog -t");
print MAIL "To: robjohnson\@black-hole.com\n";
print MAIL "From: dillybar1\@black-hole.com\n";
print MAIL "Subject: sendmail test\n\n" }
print MAIL "Test email\n";
print MAIL "$Config{'realname'} ($Config{'email'}) on $date\n";
close (MAIL);
}
im sure the file paths are all correct, the script is at <a href="http://perl-plus.virtualave.net/cgi-bin/mailtest.pl">http://perl-plus.virtualave.net/cgi-bin/mailtest.pl</a>
ROB posted this at 02:30 — 14th February 2000.
They have: 447 posts
Joined: Oct 1999
correction, here is the script minus typos:
#!/usr/local/bin/perl
$mailprog="usr/sbin/sendmail";
print "Content Type: text/html\n\n";
print "<h1>testing sendmail</h1>\n";
&send_mail;
sub send_mail {
open(MAIL,"|$mailprog -t");
print MAIL "To: robjohnson\@black-hole.com\n";
print MAIL "From: dillybar1\@black-hole.com\n";
print MAIL "Subject: sendmail test\n\n";
print MAIL "Test email\n";
close (MAIL);
}
Rob Pengelly posted this at 02:51 — 14th February 2000.
They have: 850 posts
Joined: Jul 1999
$mailprog="usr/sbin/sendmail";
shouldn't you have it as
$mailprog='usr/sbin/sendmail';
or
$mailprog="usr\/sbin\/sendmail";
?
------------------
Windmills always turn counter-clockwise. Except for the windmills in Ireland.
http://www.thehungersite.com - http://www.therainforestsite.com
http://www.ratemymullet.com - Beauty is only mullet deep.
roBofh posted this at 03:18 — 14th February 2000.
They have: 122 posts
Joined: Jun 2000
better yet, use the correct path to sendmail, i.e. /usr/sbin/sendmail instead of usr/sbin/sendmail. plus, look at the error logs. very helpful in determining what's wrong. if you try running that on a shell, does it work ok? if not, what errors does it give?
Rob Radez
OSInvestor.com
ROB posted this at 20:05 — 14th February 2000.
They have: 447 posts
Joined: Oct 1999
thanks for the suggestions, i will try them when i get home...
i believe i tried "usr\/sbin\/sendmail" but it didnt make a difference, i wasnt aware single quotes made a difference. i did forget that first '/' on the sendmail path, i dont think that was it though because i tried this...
open(MAIL,"|$mailprog -t");
close MAIL;
which did not give me an error, which means the path is correct, right?
also, script runs fine in a dos window, no errors, and virtualave says their sendmail prog is working fine.
when i get home ill change $mailprog to '/usr/sbin/sendmail' or "\/usr\/sbin\/sendmail" and see if that fixes anything.
Thanks again for the suggestions.
japhy posted this at 23:32 — 14th February 2000.
They have: 161 posts
Joined: Dec 1999
open(PROG, "|$mailprog -t"); will ONLY give you an error if you check the return value:
ROB posted this at 00:06 — 15th February 2000.
They have: 447 posts
Joined: Oct 1999
$mailprog='/usr/local/bin/perl'; works just fine.
*slaps himself in the head*
funny how the toughest problems to find are the most obvious.
thanks for the help everyone
Want to join the discussion? Create an account or log in if you already have one. Joining is fast, free and painless! We’ll even whisk you back here when you’ve finished.