Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

Re: How to send mail from Perl/Tk Program?

by CaMelRyder (Pilgrim)
on Apr 10, 2007 at 16:40 UTC ( #609201=note: print w/ replies, xml ) Need Help??


in reply to How to send mail from Perl/Tk Program?

I use Net::SMTP. The following block of code sends an email:

        $smtp = Net::SMTP->new($smtp_server_addr) or print $@;
        $smtp->mail($fromAddress);
        $smtp->to($toAddress);
        $smtp->data();
        $smtp->datasend("To: God\n");
        $smtp->datasend("Subject: Thanks for perl\n");
        $smtp->datasend("\n");
        #@body is list of strings(lines of message)
        $smtp->datasend(\@body);  
        $smtp->dataend();
        $smtp->quit



¥peace from CaMelRyder¥


Comment on Re: How to send mail from Perl/Tk Program?
Re^2: How to send mail from Perl/Tk Program?
by blazar (Canon) on Apr 11, 2007 at 07:49 UTC
    $smtp->datasend("To: God\n"); $smtp->datasend("Subject: Thanks for perl\n");

    I would say "To: $Larry\n". But $Larry himself would probably agree with you. After all, thanks to interpolation, it can be both, and much more!

Re^2: How to send mail from Perl/Tk Program?
by mikasue (Friar) on Apr 18, 2007 at 12:26 UTC
    CaMelRyder, What if the outgoing server requires authentication? How do you authenticate with Net::SMTP? Thanks,

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://609201]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others wandering the Monastery: (7)
As of 2014-08-22 04:06 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The best computer themed movie is:











    Results (146 votes), past polls