I'd really recommend not doing that either. For one, the syntax for that call looks like:
$message = "From: blah\nTo: blah\nSubject: blah\n\nmessage\n";
open (SENDMAIL,"|sendmail -i);
print SENDMAIL $message;
close(SENDMAIL);
Updated:
(Yes, I know it could be done with multiple print's, but I hate dribbling information through a pipe ...)
Which is a bigger rewrite than moving to Net::SMTP:
use Net::SMTP;
$smtp = Net::SMTP->new('mailhost');
$smtp->mail($ENV{USER}); # print MAIL "MAIL FROM ..."
$smtp->to('postmaster'); # print MAIL "RCPT TO ..."
$smtp->data(); # print MAIL "DATA\n";
$smtp->datasend("line 1\n"); # print MAIL ...
$smtp->datasend("line 2\n"); # print MAIL ...
$smtp->datasend("line 3\n"); # print MAIL ...
$smtp->dataend();
$smtp->quit;
Updated: (duh ... typing "first" w/o a "second")
Second, invoking a whole 'nother app (sendmail) when you've already got perl running is just a bunch more overhead on your server. You then also have any security holes in 'sendmail -i' to remember to look for.
My parents just came back from a planet where the dominant life form had no
bilateral symmetry, and all I got was this stupid F-Shirt.
-
Are you posting in the right place? Check out Where do I post X? to know for sure.
-
Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
<code> <a> <b> <big>
<blockquote> <br /> <dd>
<dl> <dt> <em> <font>
<h1> <h2> <h3> <h4>
<h5> <h6> <hr /> <i>
<li> <nbsp> <ol> <p>
<small> <strike> <strong>
<sub> <sup> <table>
<td> <th> <tr> <tt>
<u> <ul>
-
Snippets of code should be wrapped in
<code> tags not
<pre> tags. In fact, <pre>
tags should generally be avoided. If they must
be used, extreme care should be
taken to ensure that their contents do not
have long lines (<70 chars), in order to prevent
horizontal scrolling (and possible janitor
intervention).
-
Want more info? How to link
or How to display code and escape characters
are good places to start.
|