Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

sendmail in 1 millisecond

by gurupak (Initiate)
on Aug 15, 2005 at 06:56 UTC ( [id://483781]=perlquestion: print w/replies, xml ) Need Help??

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

This node falls below the community's threshold of quality. You may see it by logging in.

Replies are listed 'Best First'.
Re: sendmail in 1 millisecond
by brian_d_foy (Abbot) on Aug 15, 2005 at 07:14 UTC

    If you want your Perl program to spend less time sending mail, you have to let someone else spend the time doing it. That's what's happening when you let sendmail figure it all out. It's not sending the mail in a millisecond. It's queueing the mail in that long, after which your Perl program gets control again. sendmail does more work on its own.

    --
    brian d foy <brian@stonehenge.com>

      Of course brian is right ... you're going to have to work with the sendmail admin to ensure you have your local sendmail daemon configured correctly to support the queueing. Once that's done, you can use the -odd option to sendmail for the quickest async operation (all database lookups (DNS) are deferred until the queue is run). The downside to this approach is normally delayed delivery. It may take some time for the queue to be processed and hence your mail delivered.

      -derby
Re: sendmail in 1 millisecond
by merlyn (Sage) on Aug 15, 2005 at 07:48 UTC
Re: sendmail in 1 millisecond
by astroboy (Chaplain) on Aug 15, 2005 at 09:28 UTC
    Out of curiosity - what's the rush?

      Are you serious! What do you mean, "what's the rush"! Have you NEVER waited for sendmail to send mail? That 0.017 seconds is torture, it's like waiting at the Department of Motor Vehicles to renew your driver's license. All of that wasted time just spent waiting, waiting, waiting, just to send an email, it's enough to make a programmer go nuts!

      Joking, of course.

          -Bryan

      Yeah, what's the rush. In my time, when we had to walk to the office (teleworking was done by the people inventing the television), 25 miles throught the snow, and uphill both ways, we had to bang rocks together to get our ones and zeros (I fondly remember we invented the one, that made life so much easier), we were happy if we could send an email in less than a week. To the other end of the hallway. Using bangpaths.

      Youngsters. Next thing they want is interactive processing, with actual keyboard and a vt100 terminal. If batch processing was good enough for God, it's good enough for mankind.

      With heartfelt apologies to both Hormel and Monty Python, could the answer to your question lie here?

      Jack

        Well I suspect that it does, but I didn't want to start casting aspersions
Re: sendmail in 1 millisecond
by Roger (Parson) on Aug 15, 2005 at 08:11 UTC
    Network related operations (such as Email) are asynchronous, they should be handled asynchronously. Well, you can fork() a child process (or lots of child processes), and let each of them handle a sendmail request, and your main process can carry on doing other stuff.

    There are a few examples here in the monastery that does what I described above. Check out the multi-threaded network ping example. Well, you have to search the monastery for the code, I am not going to provide the link here.

Re: sendmail in 1 millisecond
by holli (Abbot) on Aug 15, 2005 at 07:11 UTC
    Give me your email address. I'll send you the (ahemm) solution.


    holli, /regexed monk/
Re: sendmail in 1 millisecond
by fauria (Deacon) on Aug 15, 2005 at 14:45 UTC
    use Time::Machine;
    read(this);

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://483781]
Approved by Roger
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (2)
As of 2024-04-19 21:08 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found