Steve Bertrand wrote:
Fúlvio Figueirôa wrote:
I solved my problem using sendmail with the code below:

open (MAIL, "|/usr/sbin/sendmail -t ");
print MAIL "From: someaddr...@somedomain\n";
print MAIL "To: someaddre...@somedomain\n";
print MAIL "Content-Type: text/plain\n";
print MAIL "Subject: Very simple email test\n\n";
print MAIL "Body of the message";
close (MAIL);

I've had issues with doing things this way in the past. From my
experience with the above code, if there is a fault, the message will
not be sent, nor will it be queued to be sent later. Depending on the
situation, not having the program follow proper SMTP protocol could be a
problem if a message is not delivered, and there is no trace of it in
any queue.

Perhaps someone here can verify that there is a workaround, but I would
highly recommend at least handing off the message so that a proper MTA
can take care of any network-type issues for you, even if the MTA is on
the localhost.

That comment confuses me. AFAIK, sendmail *is* an MTA (mail transfer agent), which e.g. handles queuing, and the above code passes a message to sendmail. I also believe that there are built-in defaults in sendmail that help you conform to certain aspects of the SMTP protocol.

I guess, if anything, instead of a file handle directly to MAIL (per
above), one could write to file, then mail it,

Don't see how that would make a difference.

--
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl

--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/


Reply via email to