in reply to How do you properly use sendmail?

I agree that using Mail::Send or Mail::Mailer is a cleaner solution. But if you really want to use sendmail, here's an example:
open SENDMAIL, "| /usr/lib/sendmail -t -n -oi" or die $!; print SENDMAIL "From: user\@domain.com\n"; print SENDMAIL "To: $recipient\n"; print SENDMAIL "Subject: testing 123\n\n"; print SENDMAIL $msg_text; close (SENDMAIL);

Replies are listed 'Best First'.
Re: Answer: How do you properly use sendmail?
by davorg (Chancellor) on Aug 29, 2002 at 09:33 UTC

    If you're going to do that then you should really check the return value from the call to open.

    open (SENDMAIL, "| /usr/lib/sendmail -t -n -oi") or die $!;
    --
    <http://www.dave.org.uk>

    "The first rule of Perl club is you do not talk about Perl club."
    -- Chip Salzenberg