Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion Groups
General
GeneralPortable MacsHardwareNetworking
Applications
Mac ApplicationsEudoraFirefox / MozillaInternet ExplorerOutlook ExpressMS OfficeEntourageExcelPowerPointWordVirtual PCMedia PlayerOther MS Products
Programming
Mac ProgrammingCodeWarriorPerl
Country Specific
Australian Mac GroupUK Mac Group

Mac Forum / Programming / Perl / January 2006



Tip: Looking for answers? Try searching our database.

return status code from sendmail in macosx

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Riccardo Perotti - 18 Jan 2006 18:52 GMT
Hi all:

I have a typical mail cgi script written in perl and can't figure out  
why I don`t get an error when the message is not sent.

My script does the typical:

open (MAIL, "|/usr/sbin/sendmail -t -i -F'$from_name' -
f'$from_mail'") or die "can't open sendmail: $!";
<- etc ->
close MAIL or die "can't close sendmail: $!";

The problem is that it does not die even though the message is not sent.

I've tried checking $? (child error) but nothing (it is '0').

I have read the sendmail and postfix man pages to no avail.

I've also tried Mail::Mailer, Mail::Send, MIME::Lite and other  
modules, but the problem is still the same: I don't get an error even  
though mail is not sent.

BTW: I know that mail is not sent because I'm checking the result in  
Console.app.

What is it that I'm missing? Is there another way of checking for  
sendmail's success from your script?

Thanks in advance,

Riccardo Perotti
--
perotti@pobox.com
www.riccardoperotti.com
Bruce Van Allen - 18 Jan 2006 19:24 GMT
>Hi all:
>
[quoted text clipped - 10 lines]
>What is it that I'm missing? Is there another way of checking for
>sendmail's success from your script?

I'm not sure what the problem is, but when my mail scripts don't work, I
find the undeliverable messages in ~/mbox. Might be some hints there.

HTH

- Bruce

__bruce__van_allen__santa_cruz__ca__
Jeremy Mates - 18 Jan 2006 22:16 GMT
* Riccardo Perotti <perotti@pobox.com>
> open (MAIL, "|/usr/sbin/sendmail -t -i -F'$from_name' -
> f'$from_mail'") or die "can't open sendmail: $!";
> <- etc ->
> close MAIL or die "can't close sendmail: $!";

If possible, use system LIST instead of system STRING, as the STRING
form runs through a shell, which could run arbitrary commands, and
thereby cause security problems. Better yet, let a module such as
Mail::Sendmail handle the low-level details.

http://search.cpan.org/perldoc/Mail::Sendmail

More details and solutions to the security risk of system STRING:

http://sial.org/howto/perl/backticks/

> What is it that I'm missing? Is there another way of checking for
> sendmail's success from your script?

/usr/sbin/sendmail varies on Mac OS X; older systems (10.2 and below)
ship with Sendmail, and newer systems (10.3 and 10.4) Postfix. Either
could accept a message without error, but hold the message in a queue
due to some other problem at the next SMTP server.

Check the /var/log/mail.log log file for clues, and use the 'mailq'
command to review the status of the local queue directories. For
Sendmail 8.12 and higher, run:

mailq
mailq -Ac
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.