【发布时间】:2013-10-05 11:16:56
【问题描述】:
我正在尝试在提交者单击“提交”按钮后将提交者在文本区域中填写的内容通过电子邮件发送给他。 “current_user”是一个wordpress codex,它获取登录用户的电子邮件。
我的代码确实打印出正确的电子邮件 + 我在文本区域中填写的内容, 但它不会将其发送到此电子邮件。 我不知道要解决什么。 感谢您的帮助!
<form action="#" method="post">
<textarea name="lesson1"></textarea><br>
<input type="submit" name="Send" value="Send to your Email" />
</form>
</div>
<?php
global $current_user;
get_currentuserinfo();
$email = $current_user->user_email;
$lesson1 = htmlspecialchars($_POST['lesson1']);
echo $lesson1, $email;
$email_subject = "Test E-Mail (This is the subject of the E-Mail)";
(mail($email, $email_subject, $lesson1);
if(mail($email, $email_subject, $lesson1)){
echo "The email($email_subject) was successfully sent.";
} else {
echo "The email($email_subject) was NOT sent.";
?>
【问题讨论】:
-
为什么要使用 txtarea?您可以使用电子邮件输入字段
-
你可以不使用电子邮件输入。然后用PHP抓取邮件
-
嘿,谢谢。我的 textarea 没有收到电子邮件地址,我是从 wordpress 数据库中获取的。我的 textarea 应该是我的电子邮件的正文。我该怎么做?
标签: php html wordpress forms email