Jump to content

PHP Mail


Cooper94

Recommended Posts

<?php
if(isset($_POST['email'])) {
$firstname = $_POST['first_name'];
$lastname = $_POST['last_name'];
$email = $_POST['email'];
$subject = $_POST['subject'];
$comment = $_POST['comments'];
$date =  date("F j, Y, g:i a");

if(empty($firstname) || empty($email) || empty($comment)) {
echo "<center><font color=red>Please Fill In All The Fields.<br></font></center>";
}else{
echo "<center><font color=red>Thank you for contacting us, we should get back to you within 24 hours.<br></font></center>";
}

$to = "[email protected]";
$subject = "$subject";
$message = "Date: $date
First Name: $firstname
Last Name: $lastname
Comments: $comment ";
$headers = "From: ". $firstname . " <" . $email . ">\r\n";
ini_set("sendmail_from", $email);

mail($to, $subject, $message, $headers);
}
?>

 

Problem is, is when I enter and actual email address it wont send but if I just put text with out the @ symbol it will send. I would love your input on what I did wrong, thank you.

Link to comment
https://forums.phpfreaks.com/topic/166927-php-mail/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.