CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
Search Posts SEARCH
Who's Online WHO'S
Log in LOG

Home: Perl Programming Help: Intermediate:
Sendmail Problems



Sep 23, 2003, 12:29 PM

Post #1 of 3 (1225 views)
Sendmail Problems Can't Post


Does anyone know why, for some unknown reason that sendmail refuse's to work in some scripts?
You see i am using this code in one script:
$email = "Project Football";
open (MAIL,"|$sendmail -t -f \"$email\"" or print "error");
print MAIL "To: $data[2]\n";
print MAIL "From: info\\n";
print MAIL "Subject: New League\n";
print MAIL "The new league ($data2356[6]) has just began. Log into your account to view your fixtures and play!\n";

print MAIL "\n";

close MAIL;

And then the same sort of thing in another, yet it does not send anything.

I've also done a check to make sure $data is correct, and refers to an email and $sendmail is correct.

I just can't understand it- on some scripts it works- and not on others.

The last way i got round it was to use a IFRAME with a small script purposly for sending an email.

But for this it is not possible, as it is run from cron, and there is many emails to send.

Any ideas why it refuse's to send on this script, but not on another?
Perhaps it is something in SendMail that requires something?



Sep 23, 2003, 12:48 PM

Post #2 of 3 (1224 views)
Re: [andy7t] Sendmail Problems [In reply to] Can't Post

I would start with the open command line and remove the switches and other stuff and see if it works:

open (MAIL,"|$sendmail");

if that works add the first, switch (-t), if that works add the second switch (-f), etc etc, until you figure out which part of the open command is causing the problem.

you might also try coding the open line like this:

open (MAIL,"|$sendmail -t -f \"$email\"") or print "error";

and see if that helps. If this script runs from a cron job you should print the error to a file instead of trying to output it to the monitor, which might cause the script to crash, but I am not 100% sure.


Thaumaturge / Moderator

Sep 23, 2003, 2:58 PM

Post #3 of 3 (1221 views)
Re: [andy7t] Sendmail Problems [In reply to] Can't Post

The problem in this case may well be that you don't have a blank line between the headers and the body.

Dave Cross, Perl Hacker, Trainer and Writer
Get more help at Perl Monks


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives