Why is my php form only working for certain emails and not all contact submissions?

I utilized a client’s contact form email for their website since my standard one didn’t work on her site. Now, she’s receiving a few form submissions, such as mine and a random, but when I submit using my personal email or she from hers, she’s not receiving the contact form email at all.

What’s wrong with this code that it’s not sending? Happy to provide whatever additional code you need (e.g. the form).

The PHP script (mail.php)

function stripFormSlashes($arr)
    {
        if(!is_array($arr))
        {
            return stripslashes($arr);
        }
        else
        {
            return array_map('stripFormSlashes', $arr);
        }
     }
 
     if(get_magic_quotes_gpc())
     {
        $_POST = stripFormSlashes($_POST);
     }
  $message = "";
  $message .= "First Name: " . htmlspecialchars($_POST['first_name'], ENT_QUOTES) . "<br >n";
  $message .= "Last Name: " . htmlspecialchars($_POST['last_name'], ENT_QUOTES) . "<br >n";
  $message .= "Email: " . htmlspecialchars($_POST['email'], ENT_QUOTES) . "<br >n";
  $message .= "Phone: " . htmlspecialchars($_POST['telephone'], ENT_QUOTES) . "<br >n";
  $message .= "Company: " . htmlspecialchars($_POST['company'], ENT_QUOTES) . "<br >n";
  $message .= "Comments: " . htmlspecialchars($_POST['message'], ENT_QUOTES) . "<br >n";
  $lowmsg = strtolower($message);
  $injection_strings = array ( "content-type:","charset=","mime-version:","multipart/mixed","bcc:","cc:");
  foreach($injection_strings as $suspect)
  {
   if((stristr($lowmsg, $suspect)) || (stristr(strtolower($_POST['first_name']), $suspect)) || (stristr(strtolower($_POST['email']), $suspect)))
   {
     die ( 'Illegal Input.  Go back and try again.  Your message has not been sent.' );
   }
  }
 $headers = "MIME-Version: 1.0rnContent-type: text/html; charset=utf-8rn";
 $headers .= "Content-Transfer-Encoding: 8bitrn";
 $headers .= "From: "" . $_POST['first_name'] . " " . $_POST['last_name'] . "" <" . $_POST['email'] . ">rn";
 $headers .= "Reply-To: " . $_POST['email'] . "rn";
  mail("[email protected]", "Contact Form Submission", $message, $headers);
  header("Location: ../thank_you.html");
?>

The form modal

<div
            class="modal fade"
            id="contactForm"
            data-bs-backdrop="static"
            data-bs-keyboard="false"
            tabindex="-1"
            aria-labelledby="contactFormLabel"
            aria-hidden="true"
        >
            <div class="modal-dialog modal-lg">
                <div class="modal-content">
                    <div
                        class="modal-header border-0"
                        style="background-color: var(--tp-theme-main-bg)"
                    >
                        <h2
                            class="modal-title fs-5"
                            id="ContactFormLabel"
                            style="font-size: 36px !important"
                        >
                            Contact Me!
                        </h2>
                        <button
                            type="button"
                            class="btn-close"
                            data-bs-dismiss="modal"
                            aria-label="Close"
                        ></button>
                    </div>
                    <div class="modal-body form-group col-12 px-5">
                        <p>
                            contact text
                        </p>
                        <form
                            action="./assets/mail.php"
                            method="POST"
                            id="contactForm"
                        >
                            <div class="row g-3">
                                <div class="col-md-6">
                                    <div class="input-item">
                                        <input
                                            type="text"
                                            name="first_name"
                                            placeholder="First Name"
                                            required
                                        />
                                    </div>
                                </div>
                                <div class="col-md-6">
                                    <div class="input-item">
                                        <input
                                            type="text"
                                            name="last_name"
                                            placeholder="Last Name"
                                            required
                                        />
                                    </div>
                                </div>
                                <div class="col-lg-12">
                                    <div class="input-item">
                                        <input
                                            type="text"
                                            name="company"
                                            placeholder="Company Name"
                                        />
                                    </div>
                                </div>
                                <div class="col-md-6">
                                    <div class="input-item">
                                        <input
                                            type="text"
                                            name="email"
                                            placeholder="Email Address"
                                            required
                                        />
                                    </div>
                                </div>
                                <div class="col-md-6">
                                    <div class="input-item">
                                        <input
                                            type="tel"
                                            name="telephone"
                                            placeholder="(555) 123-4567"
                                        />
                                    </div>
                                </div>
                                <div class="col-12">
                                    <div class="input-item-textarea">
                                        <textarea
                                            name="message"
                                            placeholder="Let us know what you're looking for"
                                            required
                                        ></textarea>
                                    </div>
                                </div>
                            </div>
                            <div class="modal-footer border-0 me-auto flex-row-reverse flex-md-row">
                                <button
                                    type="button"
                                    class="btn btn-secondary"
                                    data-bs-dismiss="modal"
                                >
                                    Close
                                </button>
                                <button
                                    type="submit"
                                    name="submit"
                                    class="btn btn-primary"
                                    style="position: relative"
                                >
                                    Submit
                                </button>
                            </div>
                        </form>
                    </div>
                </div>
            </div>
        </div>

I’ve tried to change the FROM around a bit to see if maybe that was causing issues, but that seems to just kill the submissions completely.

New contributor

Randy Christenhusz is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật