Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW

How do I send mail?

by faq_monk (Initiate)
on Oct 08, 1999 at 00:32 UTC ( #774=perlfaq nodetype: print w/ replies, xml ) Need Help??

Current Perl documentation can be found at


Use the sendmail program directly:

    print SENDMAIL <<"EOF";
    From: User Originating Mail <me\@host>
    To: Final Destination <you\@otherhost>
    Subject: A relevant subject line

    Body of the message goes here, in as many lines as you like.

The -oi option prevents sendmail from interpreting a line consisting of a single dot as ``end of message''. The -t option says to use the headers to decide who to send the message to, and -odq says to put the message into the queue. This last option means your message won't be immediately delivered, so leave it out if you want immediate delivery.

Or use the CPAN module Mail::Mailer:

    use Mail::Mailer;

                    To      => $to_address,
                    Subject => $subject,
        or die "Can't open: $!\n";
    print $mailer $body;


Log In?

What's my password?
Create A New User
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others surveying the Monastery: (9)
As of 2014-12-27 18:52 GMT
Find Nodes?
    Voting Booth?

    Is guessing a good strategy for surviving in the IT business?

    Results (177 votes), past polls