Hello all. I'm having an issue trying to email from Perl. I'm running
Mandrake 8.1 and want to send email from within a Perl script to an
external address (outside of my box). Whenever I try I don't get the
email and I get a bounce in my local email saying that I was sending
to an "unknown user". For example, If I try and send to
'myexternal.net'".
It seems that it is looking for any address only on my box. How can I
get it to look at the internet to deliver mail thru Perl? For the
record, I wrote a script to send email from PHP and it works fine.
Also, sending mail from the command line like this:
Works fine as well. I know I can use the back ticks to sort of "fudge"
it to work but I don't have shell access on my web provider space, so
it may work here but won't work there (which is ultimately where I'd
use this). This is the code I use:
#!/usr/bin/perl
$mailprog = "/usr/lib/sendmail";
$name = "Darryl";
$subject = "This is a test";
$body = "This is my perl emailer test";
open(MAIL,"|$mailprog -t");
print MAIL "To: $to\n";
print MAIL "From: $from\n";
print MAIL "Subject: $subject\n\n";
print MAIL $body;
close(MAIL);
Any ideas?
Darryl