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

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Perl Programming Help: Intermediate:
Sendmail Problems

 



andy7t
User

Sep 23, 2003, 12:29 PM

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

Hello,

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\@projectfootball.com\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 "projectfootball.com\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?

Andrew


KevinR
Veteran


Sep 23, 2003, 12:48 PM

Post #2 of 3 (543 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.


-------------------------------------------------


davorg
Thaumaturge / Moderator

Sep 23, 2003, 2:58 PM

Post #3 of 3 (540 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
http://www.dave.org.uk/
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