in reply to Sendmail problems
Hi peterr, I seem to have made you fall in love with sysopen. Fact - mostly you don't use it, you use plain open.
OK so you have this code:
open(SENDMAIL, '|/usr/sbin/sendmail -oi -t') or (unlink ($outfile), diehtml("Can't fork for sendmail: $!\n"));
First the syntax would usually be:
open(SENDMAIL, '|/usr/sbin/sendmail -oi -t') or do{ unlink($outfile); diehtml("Can't fork for sendmail: $!\n")};
Although what you have is valid. There are two parts to this line. The open() and the do{} joined by an or. How this works is this. If open works it returns 1 (true), if it fails it returns 0 (fail).
TRUE or do{does not get done} FALSE or do{does get done}
Where the TRUE/FALSE return value from open determines if the or do{} gets executed.
So presuming you are right (I don't see how this will hang) there is an issue with sendmail. What the open is doing is opening a pipe | to the sendmail binary onto the filehandle SENDMAIL. You will then be doing this:
print SENDMAIL $msg close SENDMAIL;
I presume you are sure it hangs in the open ie you have:
warn "Before SENDMAIL open\n"; open(SENDMAIL.....) warn "After open\n";
And have checked the error logs to confirm that this is exactly the problem.....If it is really hanging on that open then I suggest you have a real probelem with your host. Remember you had hanging with another shell call to lockfile (that should not of hung either)
You can test sendmail on the command line:
[root@devel3 root]# which sendmail /usr/sbin/sendmail [root@devel3 root]# /usr/sbin/sendmail -t To: root@localhost Hello Me! . [root@devel3 root]# tail /var/mail/root Received: (from root@localhost) by devel3.XXXXXXXXXX.org (8.11.6/8.11.6) id h933ZZq18591; Fri, 3 Oct 2003 03:35:35 GMT Date: Fri, 3 Oct 2003 03:35:35 GMT From: root <root@devel3.XXXXXXXXX.org> Message-Id: <200310030335.h933ZZq18591@devel3.XXXXXXXXX.org> To: root@devel3.XXXXXXXXX.org Hello Me! [root@devel3 root]#
You can use sendmail directly as shown. The . on the line by itself lets sendmail know you are done.
cheers
tachyon
s&&rsenoyhcatreve&&&s&n.+t&"$'$`$\"$\&"&ee&&y&srve&&d&&print
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Sendmail problems
by peterr (Scribe) on Oct 03, 2003 at 04:36 UTC | |
by idsfa (Vicar) on Oct 03, 2003 at 04:44 UTC |