[HRPM] Sendmail question

Christopher Hicks chicks at chicks.net
Sat Oct 5 11:03:14 CDT 2002


On Fri, 4 Oct 2002, cathleen wrote:
> I'm having some trouble getting a script to work with sendmail and I'm
> wondering if I'm just missing something really obvious. Here's what I
> am working with:
> 
> open(MAIL,"| /usr/sbin/sendmail -t"); 
> print MAIL "X-Sender: Marketing \n";
> print MAIL "To: $mail_recipients \n";
> print MAIL "From: $from_recipients \n";
> print MAIL "Reply-To: $mail_recipients \n";
> print MAIL "Subject: $subject \n";
> 
> print MAIL "$file_error \n";
> 
> close(MAIL);
> 
> If it isn't the code is there some way I can check that sendmail is
> working?

The only obvious problem is that you don't have a blank line between your 
headers and the body.  Have you tried doing the same thing from the 
command line or a shell script to see what happens?  Make a file that 
contains the right stuff and do
	cat file | /usr/sbin/sendmail -t
and see if that works.

It's easy to such the file back into perl and just make it a here document
so that things like the blank line between the headers and footers are
more obvious.  (You can still interpolate scalars in the heredoc.)

> Oh, and I don't have access to sendmail.pm so that isn't an option.

That's a pretty wacky thing to say.  Why?  There are a number of modules
out there that do this stuff for you quite easily.  I use Mail::Sendmail,
but there are plenty of other fine choices out there.  It's hard to 
believe you can't get a module on the system in question.  Even if you 
don't have root you can have load your own modules from your home 
directory pretty easily.

-- 
</chris>

The truth is rarely pure, and never simple.
	-Oscar Wilde, writer (1854-1900)




More information about the Norfolk-pm mailing list