To elaborate on Randall's response, what you should consider doing is something along the lines of:
- Present the fill-in form.
- When processing the "submit" button, do any data-verification or sanity-checking that you feel is needed.
- Fork a child process to take care of the mailing itself. Whether you choose to do the forking in a true "clean" way is up to you, and not important here.
- The original process then displays a "Thank you" page, telling the user that their data is being processed and they'll receive mail at a future point. That part is now done. It will do nothing else until called again by another form-submit.
- The second process (the child) handles the mail task, whatever that entails.
Relevant part here is that the CGI application should not be doing silly things like "sleep" when there is a use on the other end of the wire waiting.
However, I must ask this: what point is there in waiting some period of time before sending the e-mail? All invocations of this script will be waiting as well. You will still have the problem of a flood of requests flooding the mail server, just with an n-second delay. If you are that concerned about about potential mail flooding, then you have a different sort of application to consider.
--rjray
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.