有人为我建了这个网站,我不知道php和我应该修复的部分:S
基本上我在我的网站上有这个单一的文本输入表格,用户可以在他们的电子邮件地址中输入该表格,一旦他们发送提交,我将获得他们输入的电子邮件地址。
开发人员使用phpmailer,当有人提交他们的电子邮件地址时,我没有得到他们的任何电子邮件地址。我收到的唯一条目/电子邮件内容来自“我”,内容为“谢谢。我们会尽快为您更新。”
这是根文件夹上的sendmail.php:
<?php
$from = "ask@michaelfrieda2014.com";
if (isset($_REQUEST['email']) && $_REQUEST['email'] != '')
{
$email = $_REQUEST['email'];
sendMailSingup($from, $email);
sendMailSingup($from, "ask@michaelfrieda2014.com");
}
function sendMailSingup($from, $to)
{
include_once('phpmailer/class.phpmailer.php');
$mail = new PHPMailer();
$body = "Thank you. We'll update you a soon as possible.";
$mail->From = "$from";
$mail->FromName = "";
$mail->Subject = "Thank you!";
$mail->AltBody = "Thank you!"; // optional, comment out and test
$mail->MsgHTML($body);
$mail->AddAddress("$to", "");
//$mail->AddAttachment("images/phpmailer.gif"); // attachment
if(!$mail->Send()) {
echo "Mailer Error: " . $mail->ErrorInfo;
} else {
#echo "Message sent!";
echo 1;
}
}
如何制作以便获取重要信息? (他们的电子邮件地址发送到我的邮箱)。我错过了什么吗?
谢谢!
答案 0 :(得分:0)
在这条线下面......
$body = "Thank you. We'll update you a soon as possible.";
添加:
$body .= "<br><br>Sent from: $to";
(注意.=
- 这将附加到$ body变量)
如果要修复reply-to
地址,请添加以下行:
$mail->AddReplyTo($to, $to);
之前:
$mail->From = "$from";