在她单击“提交”按钮后,我正在尝试将提交者在 textarea 中填写的内容通过电子邮件发送给他。“current_user”是一个 wordpress 编码,它接收登录用户的电子邮件。
我的代码确实打印出正确的电子邮件 + 我在 textarea 中填写的内容,但它不会将其发送到此电子邮件。我不知道要解决什么。感谢您的帮助!
<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.";
?>