in reply to Is that a decent concept?
Your follow-up is commendable. It is still not great because of two things. One is minor - you are hand-parsing the parameters instead of using (say) CGI or CGI::Lite. The other is much more critical. You are still trying to eliminate "unwanted" input instead of letting through only what you want to attempt. I recommend using a simplicistic matcher for email addresses and text, maybe even as simplicistic as /^[-_\w]+\@([-_\w]+\.)+\w+$/ (for the email). This will reject some valid email addresses, but when piping stuff to sendmail (or, as recommended, MIME::Lite), that is preferrable to letting your mail server become blacklisted because of spamming.
This approach will eliminate least one class of problematic input, bad whitespace in the subject, mail body and recipient.
Again, the rule is to be very specific in what you let through, instead of only eliminating what you know is bad.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Is that a decent concept?
by davido (Cardinal) on Mar 31, 2012 at 16:27 UTC | |
by Anonymous Monk on Nov 02, 2012 at 19:57 UTC | |
|
Re^2: Is that a decent concept?
by heatblazer (Scribe) on Apr 01, 2012 at 16:05 UTC |