PHP Pear 邮件格式错误
PHP Pear email message format wrong
我知道这个标题很奇怪,我这辈子都不能把它说得很好哈哈。
我已经用多种措辞问题的方式进行了搜索,但没有任何结果。
我在网站建设中使用了电子邮件脚本,这太棒了!但是当我编辑邮件代码以添加额外的消息行时,它使序列出错。
这是我用于电子邮件消息区域的代码:
<?php
require_once "Mail.php";
// load the variables form address bar
$name = $_REQUEST["name"];
$subject = 'Customer Feedback';
$message = $_REQUEST["message"];
$from = $_REQUEST["from"];
$compname = $_REQUEST["companyName"];
$ph = $_REQUEST["phone"];
$acp = $_REQUEST['allowCommentPublish'];
$marketing = $_REQUEST['incmarketing'];
$verif_box = $_REQUEST["verif_box"];
// Checking the check boxes and marking as appropriate
if(isset($_POST['allowCommentPublish']))
{
$acp = 'Yes';
}
else
{
$acp = 'No';
}
if(isset($_POST['incmarketing']))
{
$marketing = 'Yes';
}
else
{
$marketing = 'No';
}
// Optional data checker
if($compname == '')
{
$compname = 'N/A';
}
if($ph == '')
{
$ph = 'N/A';
}
// remove the backslashes that normally appears when entering " or '
$name = stripslashes($name);
$message = stripslashes($message);
$subject = stripslashes($subject);
$acp = stripcslashes($acp);
$marketing = stripcslashes($marketing);
$from = stripslashes($from);
// check to see if verificaton code was correct
if(md5($verif_box).'a4xn' == $_COOKIE['tntcon'])
{
// if verification code was correct send the message and show this page
$ToEmail = "email@email.com";
$message = "Name: ".$name."\n".$message;
$message = "From: ".$from."\n".$message;
$message = "Comments: ".$message."\n".$message;
$message = "Allow feedback to be Published: ".$acp."\n".$message;
$message = "[ OPTIONAL DATA ]"."\n".$message;
$message = "Company Name: ".$compname."\n".$message;
$message = "Phone Number: ".$ph."\n".$message;
$message = "Allow extra Marketing? ".$marketing."\n".$message;
$headers = array ('From' => $from,
'To' => $ToEmail,
'Subject' => 'Feedback: '.$subject);
$smtp = Mail::factory('smtp', array ('host' => 'smtp.vic.exemail.com.au', 'auth' => false));
$mail = $smtp->send($ToEmail, $headers, $message);
// delete the cookie so it cannot sent again by refreshing this page
setcookie('tntcon','');
header("Location: /feedback_sent.php");
exit;
}
else
{
// if verification code was incorrect then return to contact page and show error
header("Location:".$_SERVER['HTTP_REFERER']."?subject=$subject&from=$from&message=$message&wrong_code=true");
exit;
}
?>
在我看来,这应该像这样吐出消息 body:
名字:名字在这里
发件人:电子邮件地址
评论:在此留言
允许发布反馈:response
[可选数据]
公司名称:公司
Phone 人数:Phone
允许额外营销:
这应该是它在电子邮件中看到的样子吧?
我实际得到的是:
允许发布反馈:response
[可选数据]
公司名称:公司
Phone 人数:phone
允许额外的营销?回应
发件人:电子邮件地址
名称:在此命名
评论:在此留言
这正常吗?还是我不小心把它掐死了,结果它弄乱了我的脑袋作为付款?
感谢您对此的任何帮助。
编辑:更新代码。
<?php
// -----------------------------------------
// The Web Help .com
// -----------------------------------------
// remember to replace your@email.com with your own email address lower in this code.
require_once "Mail.php";
// load the variables form address bar
$name = $_REQUEST["name"];
$subject = 'Customer Feedback';
$comment = $_REQUEST["message"];
$from = $_REQUEST["from"];
$compname = $_REQUEST["companyName"];
$ph = $_REQUEST["phone"];
$acp = $_REQUEST['allowCommentPublish'];
$marketing = $_REQUEST['incmarketing'];
$verif_box = $_REQUEST["verif_box"];
// Checking the check boxes and marking as appropriate
if(isset($_POST['allowCommentPublish']))
{
$acp = 'Yes';
}
else
{
$acp = 'No';
}
if(isset($_POST['incmarketing']))
{
$marketing = 'Yes';
}
else
{
$marketing = 'No';
}
// Optional data checker
if($compname == '')
{
$compname = 'N/A';
}
if($ph == '')
{
$ph = 'N/A';
}
// remove the backslashes that normally appears when entering " or '
$name = stripslashes($name);
$comment = stripslashes($comment);
$subject = stripslashes($subject);
$acp = stripcslashes($acp);
$marketing = stripcslashes($marketing);
$from = stripslashes($from);
// check to see if verificaton code was correct
if(md5($verif_box).'a4xn' == $_COOKIE['tntcon'])
{
// if verification code was correct send the message and show this page
$ToEmail = "jim@digital2go.com.au";
$message = "Name: ".$name."\n".$message;
$message .= "From: ".$from."\n".$message;
$message .= "Comments: ".$comment."\n".$message;
$message .= "Allow feedback to be Published: ".$acp."\n".$message;
$message .= "[ OPTIONAL DATA ]"."\n".$message;
$message .= "Company Name: ".$compname."\n".$message;
$message .= "Phone Number: ".$ph."\n".$message;
$message .= "Allow extra Marketing? ".$marketing."\n".$message;
$headers = array ('From' => $from,
'To' => $ToEmail,
'Subject' => 'Feedback: '.$subject);
$smtp = Mail::factory('smtp', array ('host' => 'smtp.vic.exemail.com.au', 'auth' => false));
$mail = $smtp->send($ToEmail, $headers, $message);
// delete the cookie so it cannot sent again by refreshing this page
setcookie('tntcon','');
header("Location: /feedback_sent.php");
exit;
}
else
{
// if verification code was incorrect then return to contact page and show error
header("Location:".$_SERVER['HTTP_REFERER']."?subject=$subject&from=$from&message=$message&wrong_code=true");
exit;
}
?>
按照您希望的顺序发送消息"continue":
$message = "Name: ".$name."\n".$message;
$message .= "From: ".$from."\n".$message;
$message .= "Comments: ".$message."\n".$message;
$message .= "Allow feedback to be Published: ".$acp."\n".$message;
$message .= "[ OPTIONAL DATA ]"."\n".$message;
$message .= "Company Name: ".$compname."\n".$message;
$message .= "Phone Number: ".$ph."\n".$message;
$message .= "Allow extra Marketing? ".$marketing."\n".$message;
我知道这个标题很奇怪,我这辈子都不能把它说得很好哈哈。
我已经用多种措辞问题的方式进行了搜索,但没有任何结果。
我在网站建设中使用了电子邮件脚本,这太棒了!但是当我编辑邮件代码以添加额外的消息行时,它使序列出错。
这是我用于电子邮件消息区域的代码:
<?php
require_once "Mail.php";
// load the variables form address bar
$name = $_REQUEST["name"];
$subject = 'Customer Feedback';
$message = $_REQUEST["message"];
$from = $_REQUEST["from"];
$compname = $_REQUEST["companyName"];
$ph = $_REQUEST["phone"];
$acp = $_REQUEST['allowCommentPublish'];
$marketing = $_REQUEST['incmarketing'];
$verif_box = $_REQUEST["verif_box"];
// Checking the check boxes and marking as appropriate
if(isset($_POST['allowCommentPublish']))
{
$acp = 'Yes';
}
else
{
$acp = 'No';
}
if(isset($_POST['incmarketing']))
{
$marketing = 'Yes';
}
else
{
$marketing = 'No';
}
// Optional data checker
if($compname == '')
{
$compname = 'N/A';
}
if($ph == '')
{
$ph = 'N/A';
}
// remove the backslashes that normally appears when entering " or '
$name = stripslashes($name);
$message = stripslashes($message);
$subject = stripslashes($subject);
$acp = stripcslashes($acp);
$marketing = stripcslashes($marketing);
$from = stripslashes($from);
// check to see if verificaton code was correct
if(md5($verif_box).'a4xn' == $_COOKIE['tntcon'])
{
// if verification code was correct send the message and show this page
$ToEmail = "email@email.com";
$message = "Name: ".$name."\n".$message;
$message = "From: ".$from."\n".$message;
$message = "Comments: ".$message."\n".$message;
$message = "Allow feedback to be Published: ".$acp."\n".$message;
$message = "[ OPTIONAL DATA ]"."\n".$message;
$message = "Company Name: ".$compname."\n".$message;
$message = "Phone Number: ".$ph."\n".$message;
$message = "Allow extra Marketing? ".$marketing."\n".$message;
$headers = array ('From' => $from,
'To' => $ToEmail,
'Subject' => 'Feedback: '.$subject);
$smtp = Mail::factory('smtp', array ('host' => 'smtp.vic.exemail.com.au', 'auth' => false));
$mail = $smtp->send($ToEmail, $headers, $message);
// delete the cookie so it cannot sent again by refreshing this page
setcookie('tntcon','');
header("Location: /feedback_sent.php");
exit;
}
else
{
// if verification code was incorrect then return to contact page and show error
header("Location:".$_SERVER['HTTP_REFERER']."?subject=$subject&from=$from&message=$message&wrong_code=true");
exit;
}
?>
在我看来,这应该像这样吐出消息 body:
名字:名字在这里
发件人:电子邮件地址
评论:在此留言
允许发布反馈:response
[可选数据]
公司名称:公司
Phone 人数:Phone
允许额外营销:
这应该是它在电子邮件中看到的样子吧?
我实际得到的是:
允许发布反馈:response
[可选数据]
公司名称:公司
Phone 人数:phone
允许额外的营销?回应
发件人:电子邮件地址
名称:在此命名
评论:在此留言
这正常吗?还是我不小心把它掐死了,结果它弄乱了我的脑袋作为付款?
感谢您对此的任何帮助。
编辑:更新代码。
<?php
// -----------------------------------------
// The Web Help .com
// -----------------------------------------
// remember to replace your@email.com with your own email address lower in this code.
require_once "Mail.php";
// load the variables form address bar
$name = $_REQUEST["name"];
$subject = 'Customer Feedback';
$comment = $_REQUEST["message"];
$from = $_REQUEST["from"];
$compname = $_REQUEST["companyName"];
$ph = $_REQUEST["phone"];
$acp = $_REQUEST['allowCommentPublish'];
$marketing = $_REQUEST['incmarketing'];
$verif_box = $_REQUEST["verif_box"];
// Checking the check boxes and marking as appropriate
if(isset($_POST['allowCommentPublish']))
{
$acp = 'Yes';
}
else
{
$acp = 'No';
}
if(isset($_POST['incmarketing']))
{
$marketing = 'Yes';
}
else
{
$marketing = 'No';
}
// Optional data checker
if($compname == '')
{
$compname = 'N/A';
}
if($ph == '')
{
$ph = 'N/A';
}
// remove the backslashes that normally appears when entering " or '
$name = stripslashes($name);
$comment = stripslashes($comment);
$subject = stripslashes($subject);
$acp = stripcslashes($acp);
$marketing = stripcslashes($marketing);
$from = stripslashes($from);
// check to see if verificaton code was correct
if(md5($verif_box).'a4xn' == $_COOKIE['tntcon'])
{
// if verification code was correct send the message and show this page
$ToEmail = "jim@digital2go.com.au";
$message = "Name: ".$name."\n".$message;
$message .= "From: ".$from."\n".$message;
$message .= "Comments: ".$comment."\n".$message;
$message .= "Allow feedback to be Published: ".$acp."\n".$message;
$message .= "[ OPTIONAL DATA ]"."\n".$message;
$message .= "Company Name: ".$compname."\n".$message;
$message .= "Phone Number: ".$ph."\n".$message;
$message .= "Allow extra Marketing? ".$marketing."\n".$message;
$headers = array ('From' => $from,
'To' => $ToEmail,
'Subject' => 'Feedback: '.$subject);
$smtp = Mail::factory('smtp', array ('host' => 'smtp.vic.exemail.com.au', 'auth' => false));
$mail = $smtp->send($ToEmail, $headers, $message);
// delete the cookie so it cannot sent again by refreshing this page
setcookie('tntcon','');
header("Location: /feedback_sent.php");
exit;
}
else
{
// if verification code was incorrect then return to contact page and show error
header("Location:".$_SERVER['HTTP_REFERER']."?subject=$subject&from=$from&message=$message&wrong_code=true");
exit;
}
?>
按照您希望的顺序发送消息"continue":
$message = "Name: ".$name."\n".$message;
$message .= "From: ".$from."\n".$message;
$message .= "Comments: ".$message."\n".$message;
$message .= "Allow feedback to be Published: ".$acp."\n".$message;
$message .= "[ OPTIONAL DATA ]"."\n".$message;
$message .= "Company Name: ".$compname."\n".$message;
$message .= "Phone Number: ".$ph."\n".$message;
$message .= "Allow extra Marketing? ".$marketing."\n".$message;