送信者が「送信」ボタンをクリックした後、送信者がテキストエリアに入力した内容をメールで送信しようとしています。「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.";
?>