【问题标题】:php contact form "Have been some problems sending the email."php 联系表格“发送电子邮件时遇到了一些问题。”
【发布时间】:2012-03-15 00:12:47
【问题描述】:

我是 php 的新手。我正在使用预构建的 html 模板。我必须配置下面提到的表单。我更改了两个值:

$emailAdmin = "myemailid@gmail.com",
$urlWebSite = "mydomain.co.cc"

但是当我点击发送电子邮件时。它给出了一条错误消息“发送电子邮件时出现了一些问题。”

<?php
// ------------------------------------------------ -----------------------------------
// CONFIGURATION PARAMETERS OF GENERAL
// ------------------------------------------------ -----------------------------------
$emailAdmin = "myemailid@gmail.com", // email admin where notices are sent
$urlWebSite = "mydomain.co.cc" // Website URL That Is added to the bottom of emails sent from contact form

$headers_mail = "From: Company Name <info@your_domain.com> \ nReply-to: info@your_domain.com";
define ("OGGETTO_MAIL", "Contact from the site.");

$str_contenuto_email = "
You are receiving this email Because someone used the card of contacts on your website.

Here the personal information we have That Contacted:

-------------------------------------------------- -----------
Name and Surname: {name}
E-mail: mail {}
IP Address: {ip}
-------------------------------------------------- -----------

This is the user's request:

-------------------------------------------------- -----------
Message: {body}
-------------------------------------------------- -----------

{url} ";
?>

我忘了提到另外一个我没有配置但默认在包含文件夹中的 php 文件:

<?php
include_once("config.php");
//------------------------------------------------------------------------------------------------
// RECUPERO IL VALORE DI TUTTI I DATI INVIATI DALL'UTENTE
//------------------------------------------------------------------------------------------------
$str_ind_ip = $_SERVER['REMOTE_ADDR'];
foreach ($_POST as $key=>$value) {
    $$key = $value;
}
//------------------------------------------------------------------------------------------------
//  PROCEDURA DI INVIO MAIL
//-------------------------------------
$str_oggetto            = OGGETTO_MAIL;
$str_contenuto_email    = str_replace("{name}",$visitor,$str_contenuto_email);
$str_contenuto_email    = str_replace("{mail}",$visitormail,$str_contenuto_email);
$str_contenuto_email    = str_replace("{ip}", $str_ind_ip,$str_contenuto_email);
$str_contenuto_email    = str_replace("{corpo}",$notes,$str_contenuto_email);
$str_contenuto_email    = str_replace("{url}",$urlWebSite,$str_contenuto_email);
$headers                = $headers_mail;

if (!@mail($emailAdmin,$str_oggetto,$str_contenuto_email,$headers)) {
    echo "<div class=\"error\">Have been some problems sending the email.</div>";
} else {
    echo "<div class=\"success\">The email has been sent successfully.</div>";
}

【问题讨论】:

标签: php


【解决方案1】:

您缺少mail() php 函数

【讨论】:

  • 他的问题集中在错误信息上。这应该是一条评论,要求提供更多代码 b/c 它显然缺少大块。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2013-10-06
  • 2012-02-25
  • 1970-01-01
  • 2011-03-29
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多