【发布时间】:2014-02-28 17:25:30
【问题描述】:
由于某种原因,当我在网站上的表单中提交电子邮件时,我没有看到它出现在我的收件箱中,它只是显示“电子邮件:”而没有添加电子邮件地址??!帮助
HTML
<form method="POST" action="/subscribe.php">
<input type="email" placeholder="Email" name="email">
<input type="submit" value="submit" name="submit">
</form>
这是我的 PHP 代码:
<?php
## CONFIG ##
# LIST EMAIL ADDRESS
$recipient = "domaininfo@gmail.com";
# SUBJECT (Subscribe/Remove)
$subject = "Notify me when you launch";
# RESULT PAGE
$location = "http://apple.com";
## FORM VALUES ##
# SENDER - WE ALSO USE THE RECIPIENT AS SENDER
# DON'T INCLUDE UNFILTERED USER INPUT IN THE MAIL HEADER!
# SEE ALSO: How to protect a php Email Form using php mail or mb_send_mail against Mail Header Injection
$sender = $recipient;
# MAIL BODY
$body .= "Name: ".$_REQUEST['Name']." \n";
$body .= "Email: ".$_REQUEST['Email']." \n";
# add more fields here if required
## SEND MESSGAE ##
mail( $recipient, $subject, $body, "From: $sender" ) or die ("Mail could not be sent.");
## SHOW RESULT PAGE ##
header( "Location: $location" );
?>
【问题讨论】:
-
问题:为什么用 ruby-on-rails 标记?