Form to Mail PHP error


#1

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 e:domainsiianantony.co.ukuserhtdocscontact.p hp on line 16
Your message was successfully sent!

My script looks like this:

PHP Code:
[php]

<? ini_set("sendmail_from", "info@ianantony.co.uk"); $subject="from".$_GET['your_name']; $headers= "From:".$_GET['your_email']."n"; $headers.='Content-type: text/html; charset=iso-8859-1'; mail ($_GET['info :cry: @ianantony.co.uk'], $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 http://phphelp.com/guidelines.php [/b]

#2

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

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

#3

Actually, unless you have ‘info@ianantony.co.uk’ passed as a parameter name in the GET request, there is no way this can work.

$_GET[‘info@ianantony.co.uk’] 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.