PHP CODE
<?php
$msg ='';
if (isset($_REQUEST['contactUs']))
{
$to = "support@example.com";
$subject = "New Contact Us";
$message = 'Name = '.$_REQUEST['name'].'<br />'.
'Email = '.$_REQUEST['email'].'<br />'.
'Message = '.$_REQUEST['message'].'<br />';
$header = "From:".$_REQUEST['email']." \r\n";
$header .= "MIME-Version: 1.0\r\n";
$header .= "Content-type: text/html\r\n";
$retval = mail ($to,$subject,$message,$header);
if( $retval == true ) {
$msg = "Message sent successfully...";
}else {
$msg = "Message could not be sent...";
}
}
?>
HTML FORM
<form name="contactform" method="post" class="form-horizontal" action="">
<div class="form-group input--hoshi" data-ng-class="{ 'has-error': contactform.inputName.$invalid && submitted }">
<div class="input-wrap">
<input type="text" class="form-control input__field input input__field--hoshi" name="name" placeholder="Name" required>
<label class="input__label input__label input__label--hoshi input__label--hoshi-color-1 input__label--hoshi input__label--hoshi-color-1"></label>
</div>
</div>
<div class="input-wrap">
<input type="email" class="form-control input input__field input__field--hoshi" placeholder="Your Email" name="email" required>
<label class="input__label input__label--hoshi input__label--hoshi-color-1"></label>
</div>
<div class="input-wrap">
<textarea data-ng-model="formData.inputMessage" class="form-control input input__field input__field--hoshi" rows="4" name="message" placeholder="message" required></textarea>
<label class="input__label input__label--hoshi input__label--hoshi-color-1"></label>
</div>
<div class="form-group">
<div class="align-center">
<button type="submit" class="btn btn-default" name="contactUs">
<span><span class="arrow-wrap"><span class="arrow"></span></span>
</span>
</button>
</div>
</div>
</form>
contact us page send email php / Simple Code email send in php
No comments:
Post a Comment