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?

Replies are listed 'Best First'.
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,