Gossamer Forum
Home : General : Perl Programming :

What am I missing?

Quote Reply
What am I missing?
Wow...this is stupid. The amount of times I used Sendmail, without even thinking about it...but now it just wont work ( on another site). I have;

Code:
open(MAIL, "|/usr/sbin/sendmail -t -oeq") || die &error("Cant open sendmail. Reason: $!");
print MAIL "To: $recipient \n";
print MAIL "From: $email \n";
print MAIL "Reply-to: $email \n";
print MAIL "Subject: $subject \n\n";
print MAIL "\n";
print MAIL $message;
print MAIL "\n";
print MAIL "We will try and get back to you ASAP\n";
print MAIL "\n";
close(MAIL);

`whereis perl` returns;

sendmail: /usr/sbin/sendmail
/usr/share/man/man8/sendmail.8.gz
/usr/src/usr.sbin/sendmail
/usr/src/contrib/sendmail
/usr/ports/mail/sendmail

For sendmail, I've tried;

/usr/sbin/sendmail -t -i
/usr/sbin/sendmail -t -oeq
/usr/sbin/sendmail -t
/usr/lib/sendmail -t -i
/usr/lib/sendmail -t -oeq
/usr/lib/sendmail -t
/usr/bin/sendmail -t -i
/usr/bin/sendmail -t -oeq
/usr/bin/sendmail -t


Can anyone see what I'm missing? The &error sub doesn't seem to be catching any errors Unsure

Cheers

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Quote Reply
Re: [Andy] What am I missing? In reply to
Check your mail log
Quote Reply
Re: [Paul] What am I missing? In reply to
Mail log says;

Nov 21 14:16:24 ensim sendmail[31953]: gALLGMC31950: to=webmaster@ace-installer.com, ctladdr=admin2 (504/504), delay=00:00:02, xdelay=00:00:02, mailer=virthostmail, pri=30665, relay=ace-installer.com, dsn=2.0.0, stat=Sent (gALLGM431956 Message accepted for delivery)

Nov 21 14:16:24 ensim sendmail[31957]: gALLGM431956: to=ace-installer, delay=00:00:02, xdelay=00:00:00, mailer=local, pri=30548, dsn=2.0.0, stat=Sent

Seems to think it got sent ok Unsure

Any ideas?

BTW: I'm still getting email to my address fine...just not the ones from this script :/

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Quote Reply
Re: [Andy] What am I missing? In reply to
Also check the return value from sendmail:

my $res = close(MAIL);
if (! $res) {
print "Sendmail exited with error code: ", $? >> 8, "\n";
}

Cheers,

Alex
--
Gossamer Threads Inc.
Quote Reply
Re: [Alex] What am I missing? In reply to
are there any filters in place along the way - like Procmail running on the mail server(s) that may be catching something particular in the message and dumping it to a different folder or /dev/null?
Quote Reply
Re: [Alex] What am I missing? In reply to
Thanks Alex...that code gave me:

Sendmail exited with error code:

Notice there is no error reported :-/

I replaced the '8' with $!. So nmow I have;

Quote:
# hopefully catch any errors, if they are made...
my $res = close(MAIL);
if (! $res) {
print "Sendmail exited with error code: ", $? >> $!, "\n";
# &error($error);
}[/code]
Its reporting;

Sendmail exited with error code: 18176

Where would I find out what this error code means?

Cheers

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!

Last edited by:

Andy: Nov 22, 2002, 7:16 AM
Quote Reply
Re: [Andy] What am I missing? In reply to
lol you can't just replace 8 with $! and expect to have a valid error code. >> 8 converts the code into the correct value.

Read the perldocs...and:

http://www.soldierx.com/...sendmail/ch36_05.htm

Last edited by:

Paul: Nov 22, 2002, 7:36 AM
Quote Reply
Re: [Paul] What am I missing? In reply to
Mmm..I put it back to how Alex wrote the code, but its still only giving me a number error code. I have tried searching Google for what the error code actually means....phrases I've tried;

sendmail error 18176
sendmail error code
sendmail error codes
error code sendmail 18176

and a few others Unsure

Any ideas? (btw, I looked at that page, but couldnt see any reference to the number ID error codes, thanks anyway)

Cheers

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Quote Reply
Re: [Andy] What am I missing? In reply to
Quote:
but couldnt see any reference to the number ID error codes, thanks anyway)

You obviously didn't read it properly then.
Quote Reply
Re: [Paul] What am I missing? In reply to
Ok, maybe I'm blind and stupid...but I can't see it anywhere Unsure I've been through the page 3 times, and can't find anything about the error code I got :|

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Quote Reply
Re: [Andy] What am I missing? In reply to
Try just "Error: $?" and see what it prints. Here are the common sendmail error codes:

Code:
%SENDMAIL_ERRORS = (
64 => 'EX_USAGE',
65 => 'EX_DATAERR',
66 => 'EX_NOINPUT',
67 => 'EX_NOUSER',
68 => 'EX_NOHOST',
69 => 'EX_UNAVAILABLE',
70 => 'EX_SOFTWARE',
71 => 'EX_OSERR',
72 => 'EX_OSFILE',
73 => 'EX_CANTCREAT',
74 => 'EX_IOERR',
75 => 'EX_TEMPFAIL',
76 => 'EX_PROTOCOL',
77 => 'EX_NOPERM',
78 => 'EX_CONFIG'
);


which translate to:

Code:
EX_USAGE => "Command line usage error",
EX_DATAERR => "Data format error",
EX_NOINPUT => "Cannot open input",
EX_NOUSER => "Addressee unknown",
EX_NOHOST => "Host name unknown",
EX_UNAVAILABLE => "Service unavailable",
EX_SOFTWARE => "Internal software error",
EX_OSERR => "System error (e.g., can't fork)",
EX_OSFILE => "Critical OS file missing",
EX_CANTCREAT => "Can't create (user) output file",
EX_IOERR => "Input/output error",
EX_TEMPFAIL => "Temp failure; user is invited to retry",
EX_PROTOCOL => "Remote error in protocol",
EX_NOPERM => "Permission denied",
EX_CONFIG => "Configuration error",
EX_UNKNOWN => "Sendmail exited with an unknown exit status: %s"


Cheers,

Alex
--
Gossamer Threads Inc.
Quote Reply
Re: [Alex] What am I missing? In reply to
After talking to their host, it turns out Sendmail has been heavily modified, to stop SPAM being sent out via it. In the end I used Net::SMTP to send the email.

Cheers

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!