PHP form no error but no message arriving

I have the following problem, I have a php script to send a form but unfortunately it saying the mail got send but nothing ever arrives. Any ideas what the problem could be? Also nothing in the spam folders.

This is the form:


$to = ""; //This is the email address you want to send the email to
//$subject_prefix = ""; //Use this if you want to have a prefix before the subject

if(!isset($_GET['action'])) {
  die("You must not access this page directly!"); //Just to stop people from visiting contact.php normally

$subject = 'Contactform'; //The subject

/* Now lets trim up the input before sending it */
$name = trim($_GET['name']); //The senders name
$email1 = trim($_GET['email1']); //The senders email address
//$subject = trim($_GET['subject']); //The senders subject
$message .= "===================================="."n";
$message .= "Kontaktanfrage"."n";
$message .= "===================================="."nn";
$message .= "Name: ".$name."n";
$message .= "email: ".trim($_GET['email1'])."n";
$message .= "Telefon: ".trim($_GET['phone1'])."n";
$message .= "Strasse: ".trim($_GET['street'])."n";
$message .= "Stadt: ".trim($_GET['city'])."n";
$message .= "------------------------------------"."nn";
$message .= "Nachricht: "."n".trim($_GET['msg'])."nn"; //The senders message
$message .= "===================================="."n";

if ( empty($name) or empty($_GET['phone1']) or empty($_GET['msg']) ) {
  echo 'errorarea|Bitte f&uuml;llen Sie folgende Felder aus: Name, Telefon und Nachricht!';

} else {
mail($to,$subject,$message,"From: ".$email1.""); //a very simple send
  echo 'contactarea|Vielen Dank '.$name.', Ihre eMail wurde verschickt.'; //now lets update the "contactarea" div on the contact.html page. The contactarea| tell's the javascript which div to update.

and this is the script:

<script language="javascript" type="text/javascript">

        function createRequestObject() {
            var ro;
            var browser = navigator.appName;
            if(browser == "Microsoft Internet Explorer"){
                ro = new ActiveXObject("Microsoft.XMLHTTP");
                ro = new XMLHttpRequest();
            return ro;

        var http = createRequestObject();

        function sendemail() {
            var msg = document.contactform.msg.value;
            var name =;
            var email1 = document.contactform.email1.value;
            var phone1 = document.contactform.phone1.value;
            var street = document.contactform.street.value;
            var city =;
            //var subject = document.contactform.subject.value;

  'get', '/js/message.php?msg='+msg+'&name='+name+'&email1='+email1+'&phone1='+phone1+'&street='+street+'&city='+city+'&action=send'); //'&subject='+subject+
            http.onreadystatechange = handleResponse;

        function handleResponse() {
            if(http.readyState == 4){
                var response = http.responseText;
                var update = new Array();

                if(response.indexOf('|' != -1)) {
                    update = response.split('|');
                    document.getElementById(update[0]).innerHTML = update[1];
<div id="contact">
    Bitte f&uuml;llen Sie alle unten aufgef&uuml;hrten Felder aus damit wir Ihre Kontaktanfrage bestm&ouml;glich bearbeiten k&ouml;nnen<br/>
    Vielen Dank.<br/>
    Um Ihre Anfrage richtig bearbeiten zu k&ouml;nnen bitten wir Sie alle Felder richtig auszuf&uuml;llen.<br/>
    <form name="contactform" id="contactform">
        <label for="name">Name *</label>
        <input type="text" name="name" id="name" size="24"><br/>

        <label for="street">Strasse</label>
        <input type="text" name="street" id="street" size="24"><br/>

        <label for="zip">PLZ/Stadt</label>
        <input type="text" name="city" id="city" size="24"><br/>

        <label for="phone1">Telefon *</label>
        <input type="text" name="phone1" id="phone1" size="24"><br/>

        <label for="email1">eMail</label>
        <input type="text" name="email1" id="email1" size="24"><br/>

        <div style="height: 10px;"></div>

        <label for="message">Nachricht *</label>
        <textarea name="msg" rows="5" id="msg" cols="25"></textarea>

        <hr noshade size="1px" color="#E0DFA5">

        <div style="color: #CFCDC3; font-size: 9px; margin-top: 10px; margin-bottom: 5px;">* Diese Felder werden ben&ouml;tigt.</div>
        <div id="contactarea" style="text-align: center;"><div id="errorarea"></div></div>
        <input type="button" class="submit" value="Absenden" name="send" onclick="sendemail();" id="submitbutton">

Any help is really appreciated. Thanks a lot.

Source: forms

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.