1

So I am trying to send an email to notify the office admin of when an email has been submitted through a form. Everything worked with no problems when I used an email ending in ".com" However, when I tried using an email ending in ".org"

$first_name = $_POST['first_name'];
$last_name = $_POST['last_name'];
$email_address = $_POST['email_address'];
$message = $_POST['message'];

if(isset($_POST['submit'])){
$to = "officeadmin@example.org"; // Office Admin Email
$from = $email_address; // User's Email
$subject = "Form Submission";

$content_admin = $first_name . " " . $last_name . " wrote the following:" . "\n\n" . $message;
$content_user = "Thanks again for contacting us. A dedicated staff member will contact you as soon as possible. Your message was: \n\n" . $message;

$headers_admin = "From:" . $from;
$headers_user = "From: Example Office";

mail($to,$subject,$content_admin,$headers_admin); //Notification email for admin
mail($from,'Thanks for contacting us',$content_user, $headers_user); //Copy of email sent to user

header('Location: contact_form_success.html'); //Redirect here after submit is clicked
}

1 Answers1

0

Basic mail() function is not well configured so sometimes problem may arise, so you

Try PHPMailer, it is well configured php mail class for sending mail.

Naveen DA
  • 4,148
  • 4
  • 38
  • 57