Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7555407
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T11:35:56+00:00 2026-05-30T11:35:56+00:00

Ive got a contact form that isnt sending but is outputting that the message

  • 0

Ive got a contact form that isnt sending but is outputting that the message is sent? Can anybody see a problem?

<?php 

$name = $_POST['name'];
$email = $_POST['email'];
$subject = $_POST['subject'];
$message = $_POST['message'];
$to = "myemail@email.co.uk";

    //begin of HTML message
    $message = "
  From : $name,
  Email: $email,
  Subject: $subject,
  Message: $message ";
   //end of message

    // To send the HTML mail we need to set the Content-type header.
   $headers  = "MIME-Version: 1.0\r\n";
$headers .= "Content-type: text/html; charset=iso-8859-1\r\n";
$headers .= "From: Website Enquiry";


if (isset($_POST['name']))  {

       // now lets send the email.
   mail($to, $subject, $message, $headers);

header('Location: ' . $_SERVER['HTTP_REFERER'] . '?e=Thankyou, we will be in touch shortly.');

} else {
    header('Location: ' . $_SERVER['HTTP_REFERER'] . '?e=There was an error sending your message, Please try again.');
    }

?> 
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-30T11:35:58+00:00Added an answer on May 30, 2026 at 11:35 am

    The “From” header should have a syntactically correct email address. You also need to check the return value of the “mail” function.

    $header .= "From: Website Enquiry <enquiry@website.com>";
    

    PS: Please improve your code formatting.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've got a basic HTML/JavaScript contact form that HostGator provided. It works pretty well...if
I've got a container that has a contact form in it.. the form is
I've got a WordPress site with a contact form that works fine on my
I've made a simple form for sending emails with attachments. The problem is that
I've got my contact form hidden with a negative margin-top, so that when the
I've got a form that contains contact info. Each has a type, and then
Here's the problem I'm having, I've got a set of logs that can grow
I've got a basic PHP contact form and have it process.php file that checks
Ahoy all. I've got a contact form PHP script. I use it for multiple
I've got this php code to send the users information from the contact form

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.