Form to Mail PHP error

When i submit my contact form on my website i get the following error message.

Warning: mail(): SMTP server response: 554 Error: no valid recipients in hp on line 16
Your message was successfully sent!

My script looks like this:

PHP Code:

<? ini_set("sendmail_from", "[email protected]"); $subject="from".$_GET['your_name']; $headers= "From:".$_GET['your_email']."n"; $headers.='Content-type: text/html; charset=iso-8859-1'; mail ($_GET['info :cry:'], $subject, " Contact letter
".$_GET['message']." " , $headers); echo ("Your message was successfully sent!"); [/php] I have spent hours and contacted my hosts to no avail. Please help Ian [b]Admin Edit: added PHP Code Tags for readability. Please review [/b]

try putting the TO and MESSAGE values into a local variable and use them instead.

<? ini_set("sendmail_from", "[email protected]"); $subject="from".$_GET['your_name']; $headers= "From:".$_GET['your_email']."n"; $headers.='Content-type: text/html; charset=iso-8859-1'; $to = $_GET['info']; $message = " Contact letter
"; $message .= $_GET['message'] $message .=" " ; mail ($to, $subject, $message, $headers); echo ("Your message was successfully sent!"); [/php]

Actually, unless you have [email protected]’ passed as a parameter name in the GET request, there is no way this can work.

$_GET[‘[email protected]’] returns is null (and displays a notice)

Just remove the array part and it should be fine.

I reccommend leaving the E_NOTICE error reporting level on when developping. It allows to find those errors quickly.

Sponsor our Newsletter | Privacy Policy | Terms of Service