in reply to (dkubb) Re: (2) Net::SMTP Implementation Details
in thread Net::SMTP and templates/ here docs
I just don't see the value in re-inventing the wheel, or trying to remember every little implementation detail, each time I need to engineer something.I don't see how boo_radley using Net::SMTP is reinventing the wheel. It's a great module, flexible and lets you send an email in as little as 8 or 9 lines.
just type perldoc Mail::Internet and you can read about how to use the smtpsend() method without worrrying about details regarding the SMTP protocol.Have you tried perldoc Net::SMTP?
In the above example, the mail() and to() methods actually tell the mailserver the recipient and sender, if you leave out the To: and From: (even subject:) headers, it shouldn't be a problem, but you still need the blank line before your real message begins. That's really all there is to remember, the rest is in the Net::SMTP docs.use Net::SMTP; use strict; my $mailserver = '127.0.0.1'; my $smtp = Net::SMTP->new($mailserver); $smtp->mail('me@mydomainname.org'); $smtp->to('recipient@theirdomain.org'); $smtp->data(); $smtp->datasend(<<MYEMAIL); To: recipient\@theirdomain.org Subject: This is my subject An example of Net::SMTP with here docs See ya later! MYEMAIL $smtp->dataend() or print "Message sending failed!"; $smtp->quit;
|
|---|