Loading

Teste E-mail por mail()

  1. <!DOCTYPE html>
  2. <html lang="en">
  3.   <head>
  4.     <meta charset="utf-8">
  5.     <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
  6.     <meta name="description" content="">
  7.     <meta name="author" content="">
  8.     <link rel="icon" href="https://v4-alpha.getbootstrap.com/favicon.ico">
  9.  
  10.     <title>WebTuga - Envio de E-mail por mail()</title>
  11.  
  12.     <!-- Bootstrap core CSS -->
  13.     <link href="https://v4-alpha.getbootstrap.com/dist/css/bootstrap.min.css" rel="stylesheet">
  14.  
  15.     <!-- Custom styles for this template -->
  16.     <link href="https://v4-alpha.getbootstrap.com/examples/starter-template/starter-template.css" rel="stylesheet">
  17.   </head>
  18.  
  19.   <body>
  20.  
  21.     <nav class="navbar navbar-toggleable-md navbar-inverse bg-inverse fixed-top">
  22.       <button class="navbar-toggler navbar-toggler-right" type="button" data-toggle="collapse" data-target="#navbarsExampleDefault" aria-controls="navbarsExampleDefault" aria-expanded="false" aria-label="Toggle navigation">
  23.         <span class="navbar-toggler-icon"></span>
  24.       </button>
  25.       <a class="navbar-brand" href="#">WebTuga</a>
  26.  
  27.       <div class="collapse navbar-collapse" id="navbarsExampleDefault">
  28.         <ul class="navbar-nav mr-auto">
  29.           <li class="nav-item active">
  30.             <a class="nav-link" href="https://www.webtuga.pt">Alojamento Web <span class="sr-only">(current)</span></a>
  31.           </li>
  32.           <li class="nav-item">
  33.             <a class="nav-link" href="https://www.webtuga.pt/dominios/">Registo de Domínios</a>
  34.           </li>
  35.         </ul>
  36.       </div>
  37.     </nav>
  38.  
  39.     <div class="container">
  40.  
  41.       <div class="starter-template">
  42.         <h1>Envio de E-mail via mail()</h1>
  43.         <p class="lead">Esta página permite testar o envio de e-mails através da função mail() do PHP</p>
  44.       </div>
  45.  
  46.         <div class="row">
  47.             <div class="col-md-8 offset-md-2">
  48.               <form method="POST">
  49. <div class="form-group"><input id="email" name="email" type="text" class="form-control form-control-lg" /></div>
  50. <div class="form-group"><button class="btn btn-success btn-lg btn-block" type="submit">Enviar E-mail</button></div>
  51. </form>
  52.  
  53.             </div>
  54.         </div>
  55. <?php
  56.  
  57. if(isset($_POST['email'])){
  58.    
  59. $email = $_POST['email'];
  60. $assunto = "E-mail de Teste via mail()";
  61. $remetente = "email@oseudominio.pt";
  62. $mensagem = "Isto é apenas uma mensagem para efeitos de debug";
  63. $headers = 'From: '. $remetente .'';
  64.    
  65. mail($email, $assunto, $mensagem, $headers);
  66. echo '<div class="row"><div class="alert alert-success text-center">E-mail enviado com sucesso!</div></div>';
  67. }
  68.  
  69. ?>
  70.     </div><!-- /.container -->
  71.  
  72.  
  73.     <!-- Bootstrap core JavaScript
  74.     ================================================== -->
  75.     <!-- Placed at the end of the document so the pages load faster -->
  76.     <script src="https://code.jquery.com/jquery-3.1.1.slim.min.js" integrity="sha384-A7FZj7v+d/sdmMqp/nOQwliLvUsJfDHW+k9Omg/a/EheAdgtzNs3hpfag6Ed950n" crossorigin="anonymous"></script>
  77.     <script>window.jQuery || document.write('<script src="https://v4-alpha.getbootstrap.com/assets/js/vendor/jquery.min.js"><\/script>')</script>
  78.     <script src="https://cdnjs.cloudflare.com/ajax/libs/tether/1.4.0/js/tether.min.js" integrity="sha384-DztdAPBWPRXSA/3eYEEUWrWCy7G5KFbe8fFjk5JAIxUYHKkDx6Qin1DkWx51bBrb" crossorigin="anonymous"></script>
  79.     <script src="https://v4-alpha.getbootstrap.com/dist/js/bootstrap.min.js"></script>
  80.     <!-- IE10 viewport hack for Surface/desktop Windows 8 bug -->
  81.     <script src="https://v4-alpha.getbootstrap.com/assets/js/ie10-viewport-bug-workaround.js"></script>
  82.   </body>
  83. </html>