Probleme mit php mail, GMX und web.de kommen nicht an.

Dieses Thema im Forum "Installation und Konfiguration" wurde erstellt von Juggler, 12. Aug. 2012.

  1. Juggler

    Juggler New Member

    Probleme mit php mail

    Hallo,

    ich habe Ärger mit php mail..

    mein System wurde nach folgendem Guide aufgesetzt:
    HowtoForge Linux Tutorials » Der Perfekte Server - Ubuntu 12.04 LTS (Apache2, BIND, Dovecot, ISPConfig 3)

    ich verwende aber anstatt squirellmail roundcube.
    Das läuft auch soweit, versendet auch via SMTP..


    Aber ich verwende auch ein kleines CMS System von PulseCMS.com

    Das Kontaktformular welches Ärger macht schaut folgendermaßen aus:


    <?php /* Copyright PulseCMS.com. All rights reserved. */ ?>
    <?php

    // Custom Fields, enter a name in between quotes to activate

    $custom_fieldname1 = ""; // Custom Field 1
    $custom_fieldname2 = ""; // Custom Field 2

    error_reporting(0);
    include_once("config.php");
    include_once("lang.php");
    $domain = $_SERVER['HTTP_HOST'];

    if($pulse_lang == 0){
    include_once("lang.php");}
    else
    if($pulse_lang == 1){
    include_once("lang_de.php");}

    if(empty($_POST["question"])){
    $question = array_rand($questions, 1);
    $answer = strtolower($questions[$question]);
    }

    if(!empty($_POST["answers"])
    && $questions[stripslashes($_POST["question"])] == strtolower(trim($_POST["answers"]))
    && md5($questions[stripslashes($_POST["question"])]) == $_POST["token"]) {
    $resp = 1;
    } elseif (isset($_POST["answers"])) {
    $resp = 2;
    $question = array_rand($questions, 1);
    $answer = strtolower($questions[$question]);

    }

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

    $name = stripslashes(strip_tags($_POST['name']));
    $email =stripslashes(strip_tags($_POST['email']));
    $custom_message1 = stripslashes(strip_tags($_POST['custom1']));
    $custom_message2 = stripslashes(strip_tags($_POST['custom2']));

    if(isset($_POST['custom1']) && (isset($_POST['custom2']))){
    $comment = "$custom_fieldname1: ". $custom_message1 ."\n"."\n"."$custom_fieldname2: ". $custom_message2 ."\n". "\n". stripslashes(strip_tags($_POST['comment']));}

    elseif(isset($_POST['custom1'])){
    $comment = "$custom_fieldname1: ". $custom_message1 ."\n"."\n". stripslashes(strip_tags($_POST['comment']));}

    elseif(isset($_POST['custom2'])){
    $comment = "$custom_fieldname2: ". $custom_message2 ."\n"."\n". stripslashes(strip_tags($_POST['comment']));}

    else{$comment = stripslashes(strip_tags($_POST['comment']));}

    $headers = "From: '". $name ."' <". $email .">\n";
    $headers .= "Reply-To: '". $name ."' <". $email .">\n";
    $headers .= "Content-Type: text/plain; charset=\"utf-8\"\n";
    $headers .= "Content-Transfer-Encoding: 8bit\n";
    $headers .= "MIME-Version: 1.0\n";

    if($name && $comment && empty($_POST['human']) && ($resp == 1) ){
    if(mail($email_contact, "$lang_form_subject", $comment, $headers)){

    $_POST['name'] = '';
    $_POST['email'] = '';
    $_POST['custom1'] = '';
    $_POST['custom2'] = '';
    $_POST['comment'] = '';
    $name = '';
    $email = '';
    $comment = '';

    echo "<p class=\"msg-green\">$lang_form_message_sent</p>";
    $question = array_rand($questions, 1);
    $answer = strtolower($questions[$question]);

    }else{
    echo "<p class=\"msg-red\">$lang_form_not_sent</p>";
    $question = array_rand($questions, 1);
    $answer = strtolower($questions[$question]);

    }
    }else{
    echo "<p class=\"msg-red\">$lang_form_all_fields</p>";
    $question = array_rand($questions, 1);
    $answer = strtolower($questions[$question]);

    }

    }elseif(isset($_POST['email'])){

    echo "<p class=\"msg-red\">$lang_form_valid_email</p>";
    $question = array_rand($questions, 1);
    $answer = strtolower($questions[$question]);

    }
    if ($resp == 2) {
    echo "<p class=\"msg-red\">$lang_blog_error_captcha</p>";
    }
    ?>
    <link rel="stylesheet" href="http://<?php echo $domain ?>/<?php echo $pulse_dir ?>/css/form.css" media="all">

    <form id=contact method=post>

    <fieldset>
    <label for="name"><?php echo $lang_form_label_name; ?></label><br>
    <input id="name" name="name" type="text" value="<?php echo stripslashes(strip_tags($_POST['name'])); ?>" >
    </fieldset>

    <fieldset>
    <label for="email"><?php echo $lang_form_label_email; ?></label><br>
    <input id="email" name="email" type="email" value="<?php echo stripslashes(strip_tags($_POST['email'])); ?>" >
    </fieldset>

    <!-- Custom Field 1 -->
    <?php if(!empty($custom_fieldname1)) {?>
    <fieldset>
    <label for="custom1"><?php echo "$custom_fieldname1"; ?></label><br>
    <input id="custom1" name="custom1" type="text" value="<?php echo stripslashes(strip_tags($_POST['custom1'])); ?>" >
    </fieldset>
    <?php } ?>

    <!-- Custom Field 2 -->
    <?php if(!empty($custom_fieldname2)) {?>
    <fieldset>
    <label for="custom2"><?php echo "$custom_fieldname2"; ?></label><br>
    <input id="custom2" name="custom2" type="text" value="<?php echo stripslashes(strip_tags($_POST['custom2'])); ?>" >
    </fieldset>
    <?php } ?>

    <fieldset>
    <input id="human" name="human" type="text" value="<?php echo stripslashes(strip_tags($_POST['human']));?>" >
    <label for="comment"><?php echo $lang_form_label_comment; ?></label><br>
    <textarea id="comment" name="comment" rows="8"><?php echo stripslashes(strip_tags($_POST['comment'])); ?></textarea>
    </fieldset>

    <fieldset>
    <p><label for="name"><?php echo $question; ?> </label>
    <input type="hidden" name="token" value="<?php echo md5($answer); ?>" >
    <input type="hidden" name="question" value="<?php echo $question; ?>" >
    <input id="name" type="text" name="answers" /></p>
    </fieldset>

    <button type="submit"><?php echo $lang_form_send; ?></button>

    </form>



    Wenn ich über das Kontaktformular an zB Gmail versende kommt die Mail zwar an, landet aber im Spam, GMX und web.de kommen gar nicht erst an..

    Bei Gmail schauts folgendermaßen aus:

    Delivered-To: meingmailadresse@gmail.com
    Received: by 10.112.27.231 with SMTP id w7csp313715lbg;
    Sun, 12 Aug 2012 09:08:20 -0700 (PDT)
    Received: by 10.180.76.135 with SMTP id k7mr11484728wiw.7.1344787699658;
    Sun, 12 Aug 2012 09:08:19 -0700 (PDT)
    Return-Path: <web2@srv01.meinedomain.de>
    Received: from srv01.meinedomain.de (meineovh-id.kimsufi.com. [xxx.xxx.xxx.xxx])
    by mx.google.com with ESMTP id bm8si12059915wib.11.2012.08.12.09.08.19;
    Sun, 12 Aug 2012 09:08:19 -0700 (PDT)
    Received-SPF: neutral (google.com: xxx.xxx.xxx.xxx is neither permitted nor denied by best guess record for domain of web2@meinedomain.de) client-ip=xxx.xxx.xxx.xxx;
    Authentication-Results: mx.google.com; spf=neutral (google.com: xxx.xxx.xxx.xxx is neither permitted nor denied by best guess record for domain of web2@srv01.meinedomain.de) smtp.mail=web2@srv01.meinedomain.de
    Received: from localhost (localhost.localdomain [127.0.0.1])
    by srv01.meinedomain.de (Postfix) with ESMTP id C146232E198E
    for <meinegmailadresse@gmail.com>; Sun, 12 Aug 2012 18:08:18 +0200 (CEST)
    X-Virus-Scanned: Debian amavisd-new at srv01.meinedomain.de
    Received: from srv01.meinedomain.de ([127.0.0.1])
    by localhost (srv01.meinedomain.de [127.0.0.1]) (amavisd-new, port 10024)
    with ESMTP id ucUDnsrIN179 for <meinegmailadresse@gmail.com>;
    Sun, 12 Aug 2012 18:08:16 +0200 (CEST)
    Received: by srv01.meinedomain.de (Postfix, from userid 5005)
    id A10E932E198F; Sun, 12 Aug 2012 18:08:16 +0200 (CEST)
    To: meinegmailadresse@gmail.com
    Subject: Kontaktformular
    X-PHP-Originating-Script: 5005:form.php
    From: 'Test' <test@test.de>
    Reply-To: 'Test' <test@test.de>
    Content-Type: text/plain; charset="utf-8"
    Content-Transfer-Encoding: 8bit
    MIME-Version: 1.0
    Message-Id: <20120812160816.A10E932E198F@srv01.meinedomain.de.de>
    Date: Sun, 12 Aug 2012 18:08:16 +0200 (CEST)

    Das ist ja ganz schön Kraut und Rüben,
    wo setze ich da an, was muss ich alles tun?

    LG
     
    Zuletzt bearbeitet: 12. Aug. 2012
  2. Till

    Till Administrator

    1) Überprüfe dass der reverse DNS Record der IP Deines Servers korrekt ist.
    2) Lege einen spf record für die Domain an.
     
  3. Juggler

    Juggler New Member

    Danke Till, es war der DNS Reverse Record der falsch war, danach ging es sofort.
    SPF ist nun auch gesetzt.

    LG
     

Diese Seite empfehlen