'Contact form in HTML using PHP without the php mail function activated
My question is, how can I integrate this HTML code to work with the PHP code below? Can the PHP code be inserted in the Submit button? I don't have php mail enabled on hosting provider
HTML
<form id="quote-request" class="form-message" action="contact.php" method="post">
<div class="form-results"></div>
<div class="form-group row">
<div class="form-field col-md-6 form-m-bttm">
<input name="contact-name" type="text" placeholder="Name" class="form-control required">
</div>
<div class="form-field col-md-6">
<input name="contact-email" type="email" placeholder="Email" class="form-control required email">
</div>
</div>
<div class="form-group row">
<div class="form-field col-md-6 form-m-bttm">
<input name="contact-phone" type="text" placeholder="Phone" class="form-control required">
</div>
<div class="form-field col-md-6">
<input name="contact-cell" type="text" placeholder="Subject" class="form-control">
</div>
</div>
<div class="form-group row">
<div class="form-field col-md-12">
<textarea name="contact-message" placeholder="Message" class="txtarea form-control required"></textarea>
</div>
</div>
<input type="text" class="hidden" name="form-anti-honeypot" value="">
<button type="submit" class="btn solid-btn sb-h">Submit</button>
</form>
</div>
</div>
<?php
ini_set("include_path", '/home/username/php:' . ini_get("include_path") );
require_once "Mail.php";
$from = "[email protected]";
$to = '[email protected]';
$host = "ssl://yourdomain.com";
$port = "465";
$username = 'test@@yourdomain.com';
$password = 'password';
$subject = "test";
$body = "test";
$headers = array ('From' => $from, 'To' => $to,'Subject' => $subject);
$smtp = Mail::factory('smtp',
array ('host' => $host,
'port' => $port,
'auth' => true,
'username' => $username,
'password' => $password));
$mail = $smtp->send($to, $headers, $body);
if (PEAR::isError($mail)) {
echo($mail->getMessage());
} else {
echo("Message successfully sent!\n");
}
?>
I tried many times and failed. Can someone help me?
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
