1

我在我的 WP 3.1 安装中有这个小猪设置,它应该是一个很好的联系表格。

问题是当我收到电子邮件时,它会显示我的虚拟主机服务器名称而不是“myemail@mydomain.com”。

有什么办法可以纠正吗?还有一个“向我发送副本”功能,我想将其用作密件抄送,以保持事情清洁。先感谢您!

这是我的 sendmail.php"

require_once("../../../../wp-load.php");

$mail = addslashes($_POST["mailForm"]);
$mail = nl2br($mail);

$from_mail = addslashes($_POST['from_mail']);

$to = wpts_get_option("general", "contact_email");

/* subject */
$subject = "New Contact Message - ATOM";

/* message */
$message = $mail;

/* To send HTML mail, you can set the Content-type header. */
$headers = "MIME-Version: 1.0\r\n";
$headers .= "Content-type: text/html; charset=iso-8859-1\r\n";

/* and now mail it */
if(@mail($to, $subject, $message, $headers))
{
?>
    <div class="success">
    <div class="box-content"><?php _e("Done! We'll contact you in few moments!", 'atom'); ?></div>
    <div class="clearboth"></div>
    </div>
<?php
}
else
{
?>
    <div class="error">
    <div class="box-content"><?php _e("Oh, sorry! Something wrong... Please, try again.", 'atom');?></div>
    <div class="clearboth"></div>
    </div>
<?php
}

?> “这是我的 sendorder.php”

require_once("../../../../wp-load.php");

$myemail = wpts_get_option("ordernow", "order_email");

$name = addslashes($_POST["name"]);
if($name == '') {
?>
    <div class="error">
    <div class="box-content"><?php _e("Please insert your name.", 'atom'); ?></div>
    <div class="clearboth"></div>
    </div>
<?php
exit;
}

$email = addslashes($_POST["email"]);
if($email == '') {
?>
    <div class="error">
    <div class="box-content"><?php _e("Please insert a email address.", 'atom'); ?></div>
    <div class="clearboth"></div>
    </div>
<?php
exit;
}

$finalOrder = nl2br( addslashes($_POST["finalOrder"]) );

$uploads = addslashes($_POST["uploads"]);

$files = explode(";", $uploads);
$uploads = '';

for($i = 0; $i < count($files); $i++) {
    $uploads .= '- <a href="'.$files[$i].'" target="_blank">'.$files[$i].'</a><br />';
}

$message = str_replace("uploads_here", $uploads, $finalOrder);

/* subject */
$subject = "New Order/Quote Request";

/* To send HTML mail, you can set the Content-type header. */
$headers = "MIME-Version: 1.0\r\n";
$headers .= "Content-type: text/html; charset=iso-8859-1\r\n";

$to = $myemail.','.$email;

/* and now mail it */
if(@mail($to, $subject, $message, $headers))
{
?>
    <div class="success">
    <div class="box-content"><?php _e("Done! You'll receive a order copy in your email.", 'atom'); ?></div>
    <div class="clearboth"></div>
    </div>
<?php
}
else
{
?>
    <div class="error">
    <div class="box-content"><?php _e("Oh, sorry! Something wrong... Please, try again.", 'atom');?></div>
    <div class="clearboth"></div>
    </div>
<?php
}

?> "

4

1 回答 1

0

我遇到了同样的问题。它出现在我的 [login_name]@[mysever] 中。

尝试调整标题。

我从http://php.net/manual/en/function.mail.php中提取了这个:

$headers .= 'To: Mary <mary@example.com>, Kelly <kelly@example.com>' . "\r\n";
$headers .= 'From: Birthday Reminder <birthday@example.com>' . "\r\n";
$headers .= 'Cc: birthdayarchive@example.com' . "\r\n";
$headers .= 'Bcc: birthdaycheck@example.com' . "\r\n";

希望这是您所需要的。

于 2012-05-22T00:00:25.557 回答