【问题标题】:PHP Form not showing up in recipient's mailboxPHP 表单未显示在收件人邮箱中
【发布时间】:2010-09-23 06:57:54
【问题描述】:

我的表单在提交时没有发送给收件人!我将文件 mail.tpl.txt 更改为直接发送到我自己的电子邮件地址作为测试,我收到了电子邮件就好了。

客户也检查了垃圾邮件文件夹,但他没有得到信息。

下面是表单代码,后面是mail.tpl.txt中的代码,然后是表单的index.php代码。

在我看来一切正常,所以我想问是否有人知道为什么他不会收到表格。如果有帮助,他会使用 qwest 发送电子邮件。

这是表单代码:

<form id="contactForm" name="form" action="form/index.php" method="post">
  <fieldset>
  <legend><font color="#000000"><strong>Please fill out the form below if you have any questions.</strong></font></legend>
    <div>
    <label for="name">Name:* </label>
    <input type="text" size="30" name="name" class="txt" id="name" />
  </div>
    <div>
    <label for="label">Phone: </label>
    <input type="text" size="30" name="phone" class="txt" id="label" />
  </div>
    <div>
    <label for="email">Email:* </label>
    <input type="text" size="30" name="email" class="txt" id="email" />
  </div>
    <div>
    <label for="message">Message: </label>
    <textarea rows="6" name="message" id="message" cols="40" class="txt"></textarea>
  </div>
    <input type="hidden" name="thanks" value="../thanks.php" />
  <input type="hidden" name="email_fields" value="email" />
  <input type="hidden" name="required_fields" value="name, email" />
  <input type="hidden" name="html_template" value="form.tpl.html" />
  <input type="hidden" name="mail_template" value="mail.tpl.txt" />
  <div class="submit">
    <input type="submit" class="btn" value="Send Message" name="Submit" id="Submit" />
  </div>
  </fieldset>
</form>

现在是 mail.tpl.text 代码:(我已经取出了我的客户的完整地址和域名。)

    To: "xxxxxxx Custom Homes" <xxxxxxx@q.com>
    From: "{name}" {phone} <{email}> <{message}>
    MIME-Version: 1.0
    Content-type: text/plain; charset={txt_charset}
    Subject: Online Contact Request from Freese Custom Homes

    Contact Information:
    {name} {phone}
    Email Address: {email}

    Contact Message:
    {message}

Lastly, here's the form's index.php code: (Again, I have taken out my client's domain name for the post)

<?php

          $script_root           = './';

          $referring_server      = ''; // Example: $referring_server = 'xxxxxxx.com, www.xxxxxxx.com';

          $language              = 'en';      // (see folder 'languages')

          $ip_banlist            = '';

          $ip_address_count      = '0';
          $ip_address_duration   = '48';

          $show_limit_errors     = 'yes';    // (yes, no)

          $log_messages          = 'no';     // (yes, no) -- make folder "temp" writable with: chmod 777 temp

          $text_wrap             = '72';

          $show_error_messages   = 'yes';

          $attachment            = 'no';    // (yes, no) -- make folder "temp" writable with: chmod 777 temp
          $attachment_files      = 'jpg, gif,png, zip, txt, pdf, doc, ppt, tif, bmp, mdb, xls, txt';
          $attachment_size       =  9000000;

          $captcha               = 'no';   // (yes, no) -- make folder "temp" writable with: chmod 777 temp

          $path['logfile']       = $script_root . 'logfile/logfile.txt';
          $path['templates']     = $script_root . 'templates/';

          $file['default_html']  = 'form.tpl.html';
          $file['default_mail']  = 'mail.tpl.txt';

  /*****************************************************
  ** Add further words, text, variables and stuff
  ** that you want to appear in the templates here.
  ** The values are displayed in the HTML output and
  ** the e-mail.
  *****************************************************/
          $add_text = array(
                              'txt_additional' => 'Additional', //  {txt_additional}
                              'txt_more'       => 'More'        //  {txt_more}

                            );

  /*****************************************************
  ** Do not edit below this line - Ende der Einstellungen
  *****************************************************/

  /*****************************************************
  ** Send safety signal to included files
  *****************************************************/
          define('IN_SCRIPT', 'true');

  /*****************************************************
  ** Load formmail script code
  *****************************************************/
          include($script_root . 'inc/formmail.inc.php');

          echo $f6l_output;

?>

【问题讨论】:

  • 'yes' 和 'no' 而不是 TRUE 或 FALSE ?

标签: php email scripting forms


【解决方案1】:

您现在正在发送纯文本电子邮件 - 您应该更正该电子邮件的标题内容类型。

只需将其设置为 text/html。这里可能有更多信息:

或者谷歌,那里有很多资源!

【讨论】:

    【解决方案2】:

    要添加适当的标题,请参阅:
    http://nl2.php.net/manual/en/function.mail.php
    示例 4.
    顺便说一句,这只是塞巴斯蒂安的一个链接。

    【讨论】:

      【解决方案3】:

      发件人标题行不正确。引号外有文字:

      From: "{name}" {phone} <{email}> <{message}> 
      

      在那里做什么。唯一正确的格式是:

      From: "{name} {phone}" <{email}>
      

      您不能在那里使用消息占位符,因为它包含新行并且会破坏邮件标题。

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2015-05-11
        • 2011-03-26
        • 2018-12-13
        • 2011-08-12
        • 2015-08-16
        • 1970-01-01
        相关资源
        最近更新 更多