|
Posted by Jon Thompson on 10/10/38 11:51
I use this to validate the email address entered into a form. Might be
useful:
function ValidateEmailAddress($EmailAddress){
$EmailAddress = strtolower(trim($EmailAddress));
if (!eregi("^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z
{2,4})$", $EmailAddress)){
return FALSE;
} else {
return $EmailAddress;
}
}
JonT
427SOHC wrote:
> In article <VB_mg.81104$A8.33391@clgrps12>, abc says...
>>
>>On Fri, 23 Jun 2006 21:58:40 +0100, Martin Jay wrote:
>>
>>> In message <vuXmg.76531$S61.45263@edtnps90>, abc <abc@arcor.de> writes
>>>>Could someone please help with a mailto action
>>>>I am trying something like this, I want the text in $the_message to be
>>>>formatted. The results I get is unformatted. line 1 line 2 line 3 line
>>>>4 ... line etc.
>>>>
>>>><?
>>>><a href='mailto:email@dot.com&subject=$subject&body=$the_message'>mail
>>>>me</a> ?>
>>>>
>>>><? $the_message=
>>>>" line 1\n"
>>>>." line 2\n"
>>>>." line 3\n"
>>>>." line 4\n"
>>>>." line 5\n"
>>>>." line 6\n"
>>>>." line 7\n"
>>>>." line etc.\n";
>>>>?>
>>>
>>> Ouch! Using the client's default email program in this way is very
>>> unreliable. Not everyone has a (default) mail program, and not all mail
>>> programs understand 'body=.' :(
>>>
>>> But if you still want to go down that route replace \n at the end of
>>> each line with %0d.
>>
>>
>>Thanks for the advice Martin, sounds like I would be opening up a can of
>>worms if I do it my way. I"ll use a form instead, the client can put their
>>email address in and sent it.
>>
>>Paul
>
> Anytime you use forms to send email, you want to be careful and validate
> the form data first. As an example, you want to may sure any form field
> information that could potentially be used in a mail header (e.g.
> $_POST['email'] = 'email@dot.com') is checked for extra addresses (such as
> "email@dot.com,email2@dot.com,email3@dot.com").
>
> Also want to check for newline characters where people can mess with your
> web
> form if they had too much free time. As as example
> "email@dot.com,email2@dot.com,email3@dot.com\nBcc:more email
> addresses.......". The "\nBcc:" adds another header where mail is blind
> copied to whatever recipients re listed. Not to make you paranoid, but you
> do want to be careful with mail forms open to the public because some
> people like to start trouble.
>
>
Navigation:
[Reply to this message]
|