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 9015855
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T03:51:16+00:00 2026-06-16T03:51:16+00:00

my php email script doesn’t seem to be sending but I can’t see why.

  • 0

my php email script doesn’t seem to be sending but I can’t see why. Also I understand that there are certain security flaws with my script, any advice with that is much appreciated!

thank you

  <?php

include('config.php');

$email1 = $_POST['email1'];

$id = $_POST['id'];
$fname = $_POST['fname'];
$firstname = $_POST['firstname'];
$surname = $_POST['surname'];


$to = '$email1';
$from = "$email"; 
    $subject = "SC - You Have a Reply"; 

        $body = "<html> 
  <body bgcolor=\"#FFFFFF\"> 
    <center> 
        <b>Dear $firstname</b> <br> 
        <font color=\"red\">You have a response, regarding your Ad on StudentClutter!</font> <br>
         <p> --------------------------------------------------------- </p>
         <b> $fname </b>
         <p> --------------------------------------------------------- </p>
         <p> ".stripslashes($_POST['body'])." </p>
         <br>
         <br>
         <br>
         <p> You can reply to them by email: $emailadd </p>
         <br>
         <br>
         <br>
         <p>Thank you for using studentclutter.com </p>
         <p> -- The Student Clutter Team </p>
    </center> 
  </body> 
</html>";

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

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

    echo "Message has been sent!"; 

 ?>
  • 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-06-16T03:51:17+00:00Added an answer on June 16, 2026 at 3:51 am

    You are using single quotes around $email1, these are not necessary. Remove the quotes and it should work just fine.

    Like this

    $to = $email1;
    

    I would advise you to check out the PHPMailer class, this class offers a whole range of features, along with security. It is very easy to use, just read through the documentation.

    UPDATE

    You have not escaped the return and new line special characters at the end of some of the headers. Change the end of the lines to look like this:

    \r\n";
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I made a little PHP script that checks if an email is valid. The
I'm building a PHP script that sends an email to people on their birthdays.
I have a php pipe script that receives an email, takes an attached *.csv
I have a simple php script on my domain that sends me an email:
I am using a script in PHP that will allow me to send email,
I've finally got this PHP email script working (didn't work on localhost…), but my
I have a php script that sends an email. It currently uses the php
I am trying to program a email piping php script that would take an
I am looking for free/opensource php form email script/class. The main requirement is that
I have a PHP file that handles sending out confirmation emails. I also have

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.