이제 막 구축을 시작하여 그에게 이메일을 보내십시오. 페이지에 들어가기 전에 사용자 이메일을 승인한다는 의미입니다.데이터베이스에 메일 문제가 발생했습니다.
if(!isset($user_found)) {
//sende email til brugere
$code = rand(111111111, 999999999);
//sendere info til brugere.
$to = $email;
$subject = "Activate din brugere - .....dk";
$headers = "From: [email protected]";
//indhold til email
$body = "Hej";
if(empty($errors))
{
if ($stmt = $mysqli->prepare('INSERT INTO `brugere` (`email`, `password`) VALUES (?, ?)')) {
/* Bind parametre */
$stmt->bind_param('ss', $email, $password);
/* Sæt værdier på parametrene */
$email = $_POST["email"];
$password = sha1($_POST["password"]);
$stmt->execute();
/* Luk statement */
$stmt->close();
echo "<div id=\"box\"><ul><li>Godkendt brugere</li></ul></div>";
} else {
/* Der er opstået en fejl */
echo 'Der opstod en fejl i erklæringen: ' . $mysqli->error;
}
}
}
$ 코드가 한계 코드를 만들어서 사용자가 링크에 대해 어떤 작업을 수행하도록해야합니다. 내 코드와 같은 모습입니다
<?php
if(!empty($_POST))
{
if ($stmt = $mysqli->prepare('SELECT * FROM `brugere` WHERE `email` = ?')) {
$stmt->bind_param('s', $email);
$email = $_POST['email'];
$stmt->execute();
$stmt->store_result();
$count = $stmt->num_rows;
$stmt->close();
if ($count > 0)
{
$user_found = 1;
}
}
else {
/* Der er opstået en fejl */
echo 'Der opstod en fejl i erklæringen: ' . $mysqli->error;
}
if(!isset($user_found)) {
//sendere info til brugere.
$to = $email;
$subject = "Activate din brugere - .....dk";
$headers = "From: [email protected]";
//indhold til email
$body = "test";
if(empty($errors))
{
if ($stmt = $mysqli->prepare('INSERT INTO `brugere` (`email`, `password`, `code`) VALUES (?, ?, ?)')) {
/* Bind parametre */
$stmt->bind_param('ss', $email, $password, $code);
/* Sæt værdier på parametrene */
$email = $_POST["email"];
$password = sha1($_POST["password"]);
$code;
$stmt->execute();
/* Luk statement */
$stmt->close();
echo "<div id=\"box\"><ul><li>Godkendt brugere</li></ul></div>";
} else {
/* Der er opstået en fejl */
echo 'Der opstod en fejl i erklæringen: ' . $mysqli->error;
}
}
}
else {
echo "<div id=\"box\"><ul><li>Der findes allerede en bruger med denne mail</li></ul></div>";
}
}
?>
,
내가이 중 원하는 것은 그 $ 코드가 바로 데이터베이스 내에서 사용자에게 이메일을 보낼 것이다 ...
있는지 질문 여기에 대해 더 많은 것을 배울 것이 있습니다.
모든 질문이 있습니다. 나는 그래서 그냥 이메일을 사용하려면 어떻게합니까
<?php
// multiple recipients
$to = '[email protected]' . ', '; // note the comma
$to .= '[email protected]';
// subject
$subject = 'Birthday Reminders for August';
// message
$message = '
<html>
<head>
<title>Birthday Reminders for August</title>
</head>
<body>
<p>Here are the birthdays upcoming in August!</p>
<table>
<tr>
<th>Person</th><th>Day</th><th>Month</th><th>Year</th>
</tr>
<tr>
<td>Joe</td><td>3rd</td><td>August</td><td>1970</td>
</tr>
<tr>
<td>Sally</td><td>17th</td><td>August</td><td>1973</td>
</tr>
</table>
</body>
</html>
';
// To send HTML mail, the Content-type header must be set
$headers = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
// Additional headers
$headers .= 'To: Mary <[email protected]>, Kelly <[email protected]>' . "\r\n";
$headers .= 'From: Birthday Reminder <[email protected]>' . "\r\n";
$headers .= 'Cc: [email protected]' . "\r\n";
$headers .= 'Bcc: [email protected]' . "\r\n";
// Mail it
mail($to, $subject, $message, $headers);
?>
는에 오는 $ = '[email protected]'에
무슨 벤 ??, 나는 그것을 보여주지 못할 .. .. ??? –
http://php.net/mail? –
대신 라이브러리를 사용해야한다고 생각합니다. 이것 좀 봐 http://swiftmailer.org/ – Songo