Gossamer Forum
Home : Products : DBMan : Customization :

Sendmail, detected, but not able to open (?)

Quote Reply
Sendmail, detected, but not able to open (?)
Below is the routine to test different possible locations of sendmail. The first is what my host recommends as an alternative, but the old sendmail is still usable. The routine detects and sets variable to /usr/lib/sendmail -t -oeq, however when it gets to html_email (copied at end of this message), I get cgi error "unable to open mail program". Is there something wrong with the html_email routine? Help!

Oh yes, putting the "|" in front of the url makes the test routine not find the sendmail program.

#---------------------------------------------------------
# Always returns location as "/usr/lib/sendmail -t -oeq"
$flags = "-t -oeq";
# The following code checks for versions of sendmail and lets the user know if one of the
# default locations does not exist.
$mailer = '/usr/sbin/exim_nproc -t -oeq';
$mailer1 = '/usr/lib/sendmail';
$mailer2 = '/usr/bin/sendmail';
$mailer3 = '/usr/sbin/sendmail';
if ( -e $mailer) {
$mailprog=$mailer;
} elsif( -e $mailer1){
$mailprog=$mailer1;
} elsif( -e $mailer2){
$mailprog=$mailer2;
} elsif( -e $mailer3){
$mailprog=$mailer3;
} else {
print "Content-type: text/html\n\n";
print "I can't find sendmail, shutting down...<br>";
print "Whoever set this machine up put it someplace weird.";
exit;
}
# Add the command line flags
$mailprog = "$mailprog $flags ";
$admin_email = 'blah@blah.com';
$admin_name = 'DBSPEC Administrator';

---------------------------------------------------------------------- html_email routine in html.pl
sub html_email {
%rec = &get_record($in{$db_key});
# the email address of the one who owns the record. Set to -1 if not used.
$db_email_field = $rec{'Name'};
# Send email to admin
open (MAIL, '$mailprog') or &cgierr('unable to open mail program');
print MAIL 'To: $admin_email\n';
print MAIL 'From: $admin_email\n';
print MAIL 'Subject: DBSPEC New Record Added\n';
print MAIL '-' x 75 . '\n\n';
foreach $column(@db_cols) {
print MAIL '$column: $rec{$column}\n';
}
close MAIL;
# send mail to user
open (MAIL, '$mailprog') or &cgierr('unable to open mail program');
print MAIL "To: $rec{'Email'}\n";
print MAIL 'From: $admin_email\n';
print MAIL 'Subject: DBSPEC New Record Added\n';
print MAIL '-' x 75 . '\n\n';
foreach $column(@db_cols) {
print MAIL '$column: $rec{$column}\n';
}
close MAIL;
}

Regards,

John

Last edited by:

fdcusa: Apr 17, 2005, 5:21 PM
Quote Reply
Re: [fdcusa] Sendmail, detected, but not able to open (?) In reply to
Okay, I fixed this one too, by myself! Smile

I use to program in the 80's-early 90's, so am just getting accustomed again to troubleshooting... Pirate

I saw references to some aid in the Unofficial DBMan page, and shall peruse it before posting again.

Thank you for your patience. Once my cgi skills are up to par, I hope to offer assistance to the group.

Thanks to all that freely give of their guidance and expertise here!

Regards,

John