Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- if(isset($_POST['tomail'])){
- $to = $_POST['tomail'];
- // subject
- $subject = $_POST['subject'];
- // message
- $message = $_POST['msg'];
- $headers = '';
- // // 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: '.$_POST['toname'].' <'.$_POST['tomail'].'>' . "\r\n";
- $headers .= 'From: '.$_POST['fromname'].' <'.$_POST['frommail'].'>' . "\r\n";
- // Mail it
- mail($to, $subject, $message, $headers);
- $send = true;
- }
- ?>
- <!DOCTYPE html>
- <html>
- <head>
- <title>Send mail</title>
- <style>
- *{
- margin: 5px 0;
- padding: 0;
- box-sizing: border-box;
- }
- p{
- font-size: 32px;
- width: 100%;
- text-align: center;
- position: absolute;
- top: 30px;
- left: 0;
- }
- form{
- width: 500px;
- margin: 100px auto;
- }
- form input,
- form textarea{
- width: 100%;
- border: 1px solid black;
- padding:10px;
- background: white;
- color: black;
- font-size: 20px;
- }
- </style>
- </head>
- <body>
- <?php if($send) echo "<p>Mail sent successfuly :D</p>"; ?>
- <form action="mail.php" method='post'>
- <input type='email' name='tomail' placeholder='Send to["email"]...'>
- <input type='text' name='toname' placeholder='Send to["name"]...'>
- <input type='text' name='subject' placeholder='Subject...'>
- <input type='text' name='fromname' placeholder='From["name"]'>
- <input type='email' name='frommail' placeholder='From["email"]'>
- <textarea name="msg" placeholder='Message...'></textarea>
- <input type="submit" value='send'>
- </form>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement