Topic: Very Simply mail send
<?php
// send mail simple
if (isset($_POST['sd'])){
$to = 'example@gmail.com';
$name = $_POST[ "name"];
$message = $_POST["message"];
$headers = 'From: '.$_POST[ "email" ].PHP_EOL;
if(isset($_POST["robot"])){
if(mail($to, name, $message, $headers)){
echo('<span class="success">Your e-mail has been sent! You should receive a reply within 24 hours!</span>');
}else{
echo('<span class="error" >Houston i have a problem</span>');
}
}else{
echo('<span class="error" >Are you a robot ?</span>');
}
}
?>
<style>
form {
width: 100%;
margin: 1em auto;
max-width: 30rem;
}
form p {
display: block;
margin: 1em auto;
}
form input[type="text"],
form input[type="email"],
form textarea {
display: block;
width: 100%;
padding: 0.5em;
border: 1px solid #DBDBDB;
background: #EAEAEA;
}
form textarea {
min-height: 8em;
width: 100%;
}
form input[type="submit"] {
display: block;
padding: 1em 0.2em;
background: #FFFFFF;
border: 1px solid #000000;
color: #000000;
min-width: 6em;
text-transform: uppercase;
transition: border 0.5s ease, color 1s ease;
}
input[type="submit"] {}
form input[type="submit"]:hover {
border-color: #FC6B5D;
color: #FC6B5D;
transition: border 0.5s ease, color 1s ease;
}
.error{
color: red;
text-align: center;
margin: 0 auto;
width: 100%;
display: block;
}
.success{
color: blue;
text-align: center;
margin: 0 auto;
width: 100%;
display: block;
}
</style>
<form method="post">
<p>
Name
<input type="text" name="name" placeholder="Your subject" required />
</p>
<p>
Email
<input type="email" name="email" placeholder="Your email" required />
</p>
<p>
Menssage
<textarea name="message" placeholder="Your message" required ></textarea>
</p>
<p>
<input type="checkbox" name="robot"> Are your a robot?
</p>
<p>
<input type="submit" name="sd" value="Send" />
</p>
</form> ..::: Moncho Varela ::::.. ..::: @Nakome ::::.. ..::: Github ::::..
