0

I have my application uploaded on many sites. And one of the capabilities is that I can send e-mails using php mail() function. The problem is that on one of them, the mail function doesn't send the e-mails.

The following code is the one that I'm using to send the e-mails. It works on the other 7 sites, but on the 8th it doesn't:

if(isset($_REQUEST) && isset($_POST['email']) && isset($_POST['subject'])){
    if((!empty($_POST['email'])) && (!empty($_POST['subject'])))
    {   
        $to = $_POST['to'];
        $subject = "Re: ".$_POST['subject'];
        $message = $_POST['email'];
        $headers = array();
        $headers[] = "Reply-To: ".$_SESSION['name']." ".$_POST['from'];
        $headers[] = "Return-Path: ".$_SESSION['name']." ".$_POST['from'];
        $headers[] = "From: ".$_SESSION['name']." ".$_POST['from'];
        $headers[] = "Organization: **********";
        $headers[] = "Subject: {$subject}";
        $headers[] = "Date: ".date(DATE_RFC2822);
        $headers[] = "MIME-Version: 1.0";
        $headers[] = "Content-Type: text/html; charset=utf-8";
        $headers[] = "X-Priority: 1";
        $headers[] = "X-Mailer: PHP/" . phpversion();

        mail($to,stripslashes($subject),stripslashes($message),implode("\r\n",$headers));
        $user= $_POST['the_id'];
        $now = date("H:i:s");
        $date = date("Y-m-d");
        $feedback_id = $_POST['f_id'];

        mysql_query("INSERT INTO chain_email(user_email,time,date,user_id,feedback_id,email) VALUES('$to','$now','$date','$user','$feedback_id','$message')",$con);

        ?>
        <script type="text/javascript">
            alert("The e-mail has been sent to <?php echo $_POST['to']; ?> at <?php echo $now; ?> on <?php echo $date; ?>");
        </script>
        <?php
    } else {
        ?>
        <script type="text/javascript">
            alert("The e-mail could not be sent. Please do not leave the textarea empty!");
        </script>
        <?php
    }
}
Emi
  • 1,165
  • 4
  • 15
  • 26

0 Answers0