I'm using mail() to send email to users when they sign up but the emails are not arriving.
$to = $email;
$subject = 'DC Account Verification';
$message = 'messagecontent';
$headers = 'From: email@test.com' . '
';
mail($to, $subject, $message, $headers);
I don't get an error. I've tried echoing out the variables to make sure they're all correct and they are. I'm using x10hosting, which I've used before, and this same function worked then. It's just not working now.
Help me out?
Thanks
I think the problem is that you are using single quotes, that's because when you use single quotes php does not interprets the escaping characters " ". So just change them to double quotes.
More information here http://www.php.net/manual/en/language.types.string.php#language.types.string.syntax.double
I believe that this is from the unnecessary after the FROM line.
Try this:
$to = $email;
$subject = "DC Account Verification";
$message = "messagecontent";
$headers = "From: email@test.com";
mail($to, $subject, $message, $headers);
Also, I recommend double-quotes for this.