in reply to (dkubb) Re: (2) Net::SMTP Implementation Details
in thread Net::SMTP and templates/ here docs

Wow. Looks like more work to me.

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?

Personally, I find using Net::SMTP much easier, the mail headers really aren't that difficult: Probably easier than the method you are using. But it all depends on the application.

boo, here's how you can use here docs with Net::SMTP (and I don't necessarily see a problem with using a here doc for this, a template might be overkill):
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;
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.

$ perldoc perldoc
Updates: changed one or two words and qualified the opening "wow"