safely using input for mail
| From: | David T-G | Date: | Mon, 13 Sep 2004 02:19:52 +0000 |
| Subject: | safely using input for mail | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-196465@lists.php.net to get a copy of this message | ||
Hi, all --
I'd like some sanity checks on safely using input for sending mail. I'm
developing a feature where one can click a 'mail this page' link, fill in
the sender's and the recipient[s]'s addresses, and add comments in the
body (eg "Hey, Bill, what do you think of this chair?") and then generate
the email. I want to watch out for gotchas.
At the moment, I am running escapeshellcmd() on the From:, To:, Subject:,
url, and body fields, and limiting the recipient field to 255 chars
(enough for about half a dozen addresses, I figure) to prevent being used
for massmailing (though I haven't yet figured out how to keep from being
called repeatedly, but at least that's just as hard for the spammer as
his own bandwidth limits). Unfortunately, escapeshellcmd() also escapes
the ? and &s in the URL and breaks it; I think it will have to go away.
I'm also ready to believe that I've overlooked half a dozen other things.
How would you guys tackle this?
TIA & HAND
:-D
--
David T-G
davidtg@justpickone.org
http://justpickone.org/davidtg/ Shpx gur
Pbzzhavpngvbaf Qrprapl Npg!