Reputation: 1531
I'm trying to have entered email address delivered to my inbox so that when user enters his email in form, I get an email notification about it.
This is the php:
<?php
if($_POST){
$email = $_POST['email'];
//send email
mail("[email protected]", "Newsletter Signup:" .$email);
}
?>
What am I doing wrong since it's not working atm ?
Upvotes: 0
Views: 311
Reputation: 10272
What is the problem with this question
The reason why your mails won't be delivered can be really anything. Check the environments of your mailserver and your webserver.
How to solve the problem
Since the mail() function implementation in php is returning a boolean, you can use this return value to detect an error:
<?php [...]
$email = $_POST['email'];
$success = mail("[email protected]", "Newsletter Signup:", $email);
if (!$success) {
$error = error_get_last();
var_export($error);
}
[...] ?>
Maybe this will help you to locate the problem.
Upvotes: 2