PHP联系表格 - 回复

时间:2013-03-25 00:13:52

标签: php forms

我已经查看了有关PHP Contact Form的其他问题并尝试了不同的选项,但似乎没有任何工作,所以这是我的代码。我无法让回复邮件发送到sumbitter。在回复中我得到:$ email@hn02.wiroos.com(wiroos是托管公司名称),其他一切正常。

表格:

<form action="procesar_form.php" method="post" name="formulario" id="formulario" onsubmit='return validarFormulario()'>
        <label for="nombre">Nombre </label>
        <input type="text" name="nombre" id="nombre" size="60"/>

        <label for="apellido">Apellido </label>
        <input type="text" name="apellido" id="apellido" size="60"/>

        <label for="email">Email </label>
        <input type="text" name="email" id="email" size="60"/>

        <label for="comentarios">Comentarios</label>
        <textarea name="comentarios" id="comentarios" cols="44" rows="10"></textarea>

        <input type="button" name="enviar" id="enviar" value="Enviar" onclick="validarFormulario()" /></textarea>

</form>

PHP代码:

$to      = 'elunicotomas@gmail.com';
$subject = 'Contacto PowerFitness';
$message = 'Nombre: ' . $_REQUEST['nombre'] . "\r\n" .
            'Apellido: ' . $_REQUEST['apellido'] . "\r\n" .
            'Email: ' . $_REQUEST['email'] . "\r\n" .
            'Comentarios: ' . $_REQUEST['comentarios'];
$headers = 'From: Contacto PowerFitness pedidos@powerfitness.com.ar' . "\r\n" .
    'Reply-To: pedidos@powerfitness.com.ar' . "\r\n" .
    'X-Mailer: PHP/' . phpversion();

mail($to, $subject, $message, $headers);

header("Location: ../../index.html");

我发了一封电子邮件到我的地址(来自表格),所以我可以看到电子邮件来源,现在是:

> Delivered-To: elunicotomas@gmail.com Received: by 10.60.132.7 with
> SMTP id oq7csp23527oeb;
>         Sun, 24 Mar 2013 17:57:27 -0700 (PDT) X-Received: by 10.236.160.195 with SMTP id u43mr5762986yhk.104.1364173047442;
>         Sun, 24 Mar 2013 17:57:27 -0700 (PDT) Return-Path: <nobody@hn02.wiroos.com> Received: from hn02.wiroos.com
> (hn02.wiroos.com. [199.115.114.195])
>         by mx.google.com with ESMTPS id h65si7425664yhk.272.2013.03.24.17.57.27
>         (version=TLSv1 cipher=RC4-SHA bits=128/128);
>         Sun, 24 Mar 2013 17:57:27 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of nobody@hn02.wiroos.com
> designates 199.115.114.195 as permitted sender)
> client-ip=199.115.114.195; Authentication-Results: mx.google.com;
>        spf=pass (google.com: best guess record for domain of nobody@hn02.wiroos.com designates 199.115.114.195 as permitted sender)
> smtp.mail=nobody@hn02.wiroos.com Received: from nobody by
> hn02.wiroos.com with local (Exim 4.80)    (envelope-from
> <nobody@hn02.wiroos.com>)     id 1UJvj2-0002cx-SK     for
> elunicotomas@gmail.com; Sun, 24 Mar 2013 21:57:25 -0300 To:
> elunicotomas@gmail.com Subject: Contacto PowerFitness X-PHP-Script:
> powerfitness.com.ar/contacto/procesar_form.php for 200.70.31.20 From:
> Contacto PowerFitness pedidos@powerfitness.com.ar Reply-To:
> $email@hn02.wiroos.com X-Mailer: PHP/5.3.21 Message-Id:
> <E1UJvj2-0002cx-SK@hn02.wiroos.com> Date: Sun, 24 Mar 2013 21:57:24
> -0300 X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname -
> hn02.wiroos.com X-AntiAbuse: Original Domain - gmail.com X-AntiAbuse:
> Originator/Caller UID/GID - [99 32007] / [47 12] X-AntiAbuse: Sender
> Address Domain - hn02.wiroos.com X-Get-Message-Sender-Via:
> hn02.wiroos.com: uid via acl_c_vhost_owner from authenticated_id:
> nobody from /only user confirmed/virtual account not confirmed
> X-Source:  X-Source-Args: /usr/local/apache/bin/httpd -k start -DSSL 
> X-Source-Dir: powerfitness.com.ar:/public_html/contacto
> 
> Nombre: Tomas Apellido: Perez Ponisio Email: elunicotomas@gmail.com
> Comentarios: 132465

1 个答案:

答案 0 :(得分:1)

请尝试以下方法:

1)使用\ n而不是\ r \ n。也许您的主机使用的是linux分隔符,并且只是没有识别Windows返回的运输。

2)如果这不起作用,请尝试将Reply-To的情况更改为Reply-to。某些邮件服务器区分大小写

3)如果这也不起作用,请使用您的表单发送电子邮件,当您收到它时,打开电子邮件的来源,检查包含的标题,并在此处发布以查看您的邮件服务器实际上是在识别您尝试使用的标头。