Reputation: 1
I am trying to fix the error but I can't. There are lot of stuff about PHPmailer on internet I tried it but my website is not sending messages. Please fix the error. I am pasting my code. Please let me know other methods to send message also.
<div class="row">
<div class="col-lg-8">
<div class="boxed-grey">
<form id="contact-form">
<div class="row">
<div class="col-md-6">
<div class="form-group">
<form action="ContactFormHandler.php"
method="post">
<label for="name">
Name</label>
<input type="text" class="form-control"
id="name" placeholder="Enter name" required="required" />
</div>
<div class="form-group">
<label for="email">
Email Address</label>
<div class="input-group">
<span class="input-group-addon"><span
class="glyphicon glyphicon-envelope"></span>
</span>
<input type="email"
class="form-control" id="email" placeholder="Enter email"
required="required" /></div>
</div>
</div>
<div class="col-md-6">
<div class="form-group">
<label for="name">
Message</label>
<textarea name="message" id="message"
class="form-control" rows="9" cols="25" required="required"
placeholder="Message"></textarea>
</div>
</div>
require("path of phpmailer folder
\class.phpmailer.php");
$mail = new PHPMailer();
$mail->IsSMTP();
$mail->Host = "mymail.domain.com";
$mail->SMTPAuth = true;
$mail->Username = "myemail";
$mail->Password = "psswrd";
$mail->From = "[email protected]";
$mail->FromName = "Your Name";
$mail->AddReplyTo("[email protected]");
$mail->AddAddress("[email protected]");
$mail->IsHTML(true);
$mail->Subject = "Test message sent using the
PHPMailer component";
$mail->Body = "This is a test message.";
$mail->Send();
?>
<div class="col-md-12">
<button type="submit" class="btn btn-skin
pull-right" id="btnContactUs">
Send Message</button>
</div>
</div>
</form>
</div>
</div>
Upvotes: 0
Views: 38
Reputation: 15509
also it does not seem that you are opening php before your require statement. therefore the php section won't work.
You need this
<?php
require....
Upvotes: 0
Reputation: 15509
your name and email inputs do not have a name attribute listed for them so will not send any data in the form submission.
you need to alter them as follows:
<input type="text" class="form-control" name="name" id="name" placeholder="Enter name" required="required" />
<input type="email" class="form-control" name="email" id="email" placeholder="Enter email" required="required" />
This may not be the issue that causing the error but it will cause an issue.
Upvotes: 1