Page 1 of 1

PHP form data via email

Posted: Sun Jun 28, 2009 12:48 pm
by aaron72
<?php

$email = "First Name:\t$_POST[fname]\n";
$email .= "Last Name:\t$_POST[lname]\n";
$email .= "Address 1:\t$_POST[add1]\n";
$email .= "Address 2:\t$_POST[add2]\n";
$email .= "City:\t$_POST[city]\n";
$email .= "State:\t$_POST[state]\n";
$email .= "Zip:\t$_POST[zip]\n";
$email .= "Email-id:\t$_POST[eid]\n";
$email .= "Phone:\t$_POST[phone]\n";

$destinatar = "info@xxx.com";
$subiect = "Resume of fname";

$detalii = "From: eid\n";
$detalii .= "Reply-To: $_POST[email]\n\n";

$sent =mail($destinatar, $subiect, $email, $detalii);

if($sent)
{print "Your mail was sent successfully"; }
else
{print "We encountered an error sending your mail"; }

Re: PHP form data via email

Posted: Sun Jun 28, 2009 4:00 pm
by a94060
what is this for? Is there a question that i just cannot see? also wap code in php tags

Re: PHP form data via email

Posted: Sun Jun 28, 2009 4:35 pm
by aaron72
There is an error on this code. I am getting message "We encountered an error sending your mail" trying to figure out why Send is failing?

a94060 wrote:what is this for? Is there a question that i just cannot see? also wap code in php tags

Re: PHP form data via email

Posted: Sun Jun 28, 2009 5:11 pm
by a94060
Try echoing $destinatar, $subiect, $email, $detalii . See if you are getting the proper values for each. If you are, the problem may lie in the host not allowing you to send emails.