bjs has asked for the wisdom of the Perl Monks concerning the following question:

I thought this would be easy and could be handled by just some 'system' stmts. for the scripting (i.e. system("telnet mail.abc.com 25") ) - make the connection and then then use more print `` or system stmts (HELO, Mail From etc.. - after the 220/250 responses) - I am on a Windows box, not Unix - The Telnet connect does fine - and after that it will only accept STDIN,(I was an SMTP Postmaster for years so I have the Connect/Send/Receive seq. down pat - LOL - ) I am just taking some data from a .htm form-> pl or cgi and then Email a portion (From/Recpt/Datestamp/Subject) and then also take all of the Form Data and push to a Shared File for later review. MailServer is Fixed at this point, may do a NSLOOKUP for mx and then save that as a Var, or @ARRAY and peel what is needed from there,etc.. DO I have to use NET::SMTP, or IO::Socket::INET - is the same true with any TELNET Session (i.e. FTP ) using NET::FTP ? Thanks to All !

Replies are listed 'Best First'.
Re: telnet smtp-
by Corion (Patriarch) on Oct 05, 2009 at 17:00 UTC

    system waits for the child program to finish before it continues. So your idea won't ever work.

    Just use MIME::Lite and be done with it. Hand-rolling SMTP-code is a thing of the past. Also, consider very, very carefully whether you want to accept data from a CGI, as that will likely open many venues to send spam through your machine.