addemail.html
<!DOCTYPE html> <html lang="cn"> <head> <meta charset="UTF-8"> <title>猫王商店 - 添加邮箱</title> <link rel="stylesheet" href="style.css"> </head> <body> <img src="blankface.jpg" width="161" height="350" alt="" style="float:right"> < Img name = "elvislogo" src = "elvislogo.gif" width = "229" height = "32" border = "0" alt = "the Make Me Elvis" > < the p- > E-mail and add your name to the < strong > Elvis Shop </ strong > email list. </ The p- > < form Method, = "POST" Action = "addemail.php" > < label for = "name" > Name: < type="text" id="name" name="name"><br> <label for="email">邮箱:</label> <input type="text" id="email" name="email"><br> <input type="submit" name="Submit" value="提交"> </form> </body> </html>
addemail.php
echo 'complete fill. ' ; mysqli_close($dbc); ?>
sendemail.html
<!DOCTYPE html> <html lang="cn" dir="ltr"> <head> <meta charset="utf-8"> <title>猫王商店 - 发送邮件</title> <<link rel="stylesheet" href="style.css"> </head> <body> <img src="blankface.jpg" alt="黑脸" width="161" height="350" style= "a float: right" > < IMG the src = "elvislogo.gif" Alt = "Elvis Store" name = "elvislogo" width = "229" height = "32" border = "0" > < P > < strong > private: </ strong > only use Elmer < br > write and send messages to members of the list of mailboxes. </ P > < form Action = "sendemail.php" Method = "POST" > <</label><br> <input type="text" name="subject" id="subject" size="30"><br> <label for="elvismail">邮件的内容:</label><br> <textarea name="elvismail" id="elvismail" rows="8" cols="40"></textarea><br> <input type="submit" name="Submit" value="提交"> </form> </body> </html>
sendemail.php
? < PHP $ from = '[email protected]' ; $ Subject = $ _POST [ 'Subject' ]; $ text = $ _POST [ 'elvismail' ]; $ DBC = mysqli_connect ( '127.0.0.1', 'the root' , '', 'elvis_store' ) or Die ( 'links MySQL fail.' ); $ query = "the SELECT * the FROM EMAIL_LIST" ; $ the Result = mysqli_query ( $ DBC , $ query ) or Die ( 'query the database failed'. ) ; while($row = mysqli_fetch_array($result)){ $name = $row['name']; $msg = "亲爱的 $name ,\n $text"; $to = $row['email']; mail($to, $subject, $msg, 'From:'.$from); echo '邮件发送到了:'.$to.'<br>'; } mysqli_close($dbc); ?>
removeemail.html
<!DOCTYPE html> <html lang="cn" dir="ltr"> <head> <meta charset="utf-8"> <title>猫王商店 - 删除邮箱</title> <link rel="stylesheet" href="style.css"> </head> <body> <img src="blankface.jpg" alt="黑脸" width="161" height="350" style= "float: right" > < img src = "elvislogo.gif" alt = "Elvis logo" width = "229" height = "32" name = "elvislogo" border = "0" > < the p- > input you want to remove the mailbox. </ P > < form Action = "removeemail.php" Method = "POST" > < label for = "In Email" > E-mail Address: </ label > <="name" size="30"><br> <input type="submit" name="Remove" value="移除"> </form> </body> </html>
removeemail.php
? < PHP $ DBC = mysqli_connect ( '127.0.0.1', 'root', '', 'elvis_store' ) or Die ( 'MySQL link failure.' ); $ Email = $ _POST [ 'Email' ]; $ Query = "DELETE the FROM EMAIL_LIST the WHERE Email = ' $ Email '" ; mysqli_query ( $ DBC , $ query ) or Die ( 'failed to query the database.' ); echo $ Email "has been removed." ; mysqli_close ( $ DBC ; ?>