Reputation: 21
I'm trying to set some PHP, where if a user enters in their email address; they send an email to the organization.
Here's my html
<input type="text" name="email" size="20" /><br />
<input type="submit" name="submit" value="submit" />
And here's my PHP script
$email = $_POST['email'];
mail('[email protected]', 'This is a Subject', 'This is the body of the email', 'From $email');
I have a real email address that I'm using for this code. But it won't send it to the email that I want; what am I doing wrong? I am also working on a local server as well. Does that make a difference?
Upvotes: 0
Views: 3375
Reputation: 1325
// message lines should not exceed 70 characters (PHP rule), so wrap it
$message = wordwrap($message, 70);
for more help:http://www.w3schools.com/php/php_mail.asp
Upvotes: 0
Reputation: 780688
The format of your From
header is incorrect. You're missing the colon :
.
mail('[email protected]', 'This is a Subject', 'This is the body of the email', 'From: $email');
Upvotes: 2