php和mysql数据没有发送确认邮件?

8hhllhi2  于 2021-06-21  发布在  Mysql
关注(0)|答案(1)|浏览(266)

这个问题在这里已经有答案了

php邮件功能无法完成电子邮件的发送(27个答案)
两年前关门了。
所以我有一个表格,你可以要求某人通过电子邮件加入你的小组,但由于某些原因,它没有发送电子邮件,它昨天工作得非常好,现在似乎有些东西坏了。表格如下:

<div class="form" style="background: white; box-shadow: 0 0px rgba(0, 0, 0, 0);">
    <form id="addmember" action="addingmember.php" method="post" autocomplete="off">
        <div class="field-wrap">
            <label style="position: relative; color: black;">
                Member Email:
            </label>
            <input type="email" required autocomplete="off" name="memberemail"
                   style="color: black; padding: 8px; height: 48px;"/>
        </div>
        <button type="submit" class="button button-block" name="submit">
            Submit
        </button>
    </form>

这是addingmember代码:

<?php

include '../db_connection.php';

session_start();

$leaguename = $_SESSION['league_name'];
$startdate = $_SESSION['start_date'];
$enddate = $_SESSION['end_date'];
$joincode = $_SESSION['joincode'];

$_SESSION['memberemail'] = $_POST['memberemail'];

$memberemail = $link->escape_string($_POST['memberemail']);

//check member Email matches
$memberemail = $link->query("SELECT Email FROM logins WHERE Email =' " . $_SESSION['memberemail'] . "'")->fetch_assoc()['memberemail'];

$to = $memberemail;
$subject = "Becoming part of $leaguename";
$body .= "So you want to become part of $leaguename?" . PHP_EOL;
$body .= "Please click the link below to join!" . PHP_EOL;
$body .= "http://www.linkhere.com/login/verify.php?memberemail=$memberemail&joincode=$joincode;" . PHP_EOL;

$headers = "From: emailhere";

mail($to, $subject, $body, $headers);
//header("location: addanothermember.php");

?>
toiithl6

toiithl61#

$memberemail = $link->query("SELECT Email FROM logins WHERE Email =' " . $_SESSION['memberemail'] . "'")->fetch_assoc()['memberemail'];

基本上,您在查询中选择“email”,但希望从中获取“memberemail”。也许这就是问题所在。
为$memberemail变量添加检查。
另外,在查询中使用$\u session['memberemail']而不转义也有点危险。

相关问题