php - Why isn't my contact form using PHPMailer working? -
i made contact form send information email, , whenever submit form, redirected php file (mywebsite.com/contact.php) , shown internal server error (the 500 kind). did wrong? because have html , php code in different files? included contact form in case relevant.
<?php if(isset($_post['submit'])) { $message= 'full name: '.$_post['name'].'<br/> comments: '.$_post['comments'].'<br/> email: '.$_post['email'].' '; require 'phpmailer/phpmailerautoload.php'; $mail = new phpmailer; //$mail->smtpdebug = 3; // enable verbose debug output $mail->issmtp(); // set mailer use smtp $mail->host = 'smtp.mail.yahoo.com'; // specify main , backup smtp servers $mail->smtpauth = true; // enable smtp authentication $mail->username = 'aroncea@yahoo.com'; // smtp username $mail->password = 'letmejusteditthisout'; // smtp password $mail->smtpsecure = 'tls'; // enable tls encryption, `ssl` accepted $mail->port = 465; // tcp port connect $mail->setfrom($_post['email'], $_post['name']); $mail->addreplyto($_post['email'], $_post['name']); $mail->addaddress('aroncea@yahoo.com'); // add recipient $result = $mail->send(); $message = $result ? 'successfully sent!' : 'sending failed!'; unset($mail); $mail->subject = "new form submission"; $mail->msghtml($message); ?>
<!-- container (contact section) --> <form action="newcontact.php" method="post" name='contactform' id='contactform' enctype="text/plain"> <div id="contact" class="container-fluid bg-grey"> <h2 class="text-center">contact</h2> <div class="row"> <div class="col-sm-5"> <p>contact , we'll within 24 hours. </p> <p><span class="glyphicon glyphicon-map-marker"></span> burlington, on</p> <p><span class="glyphicon glyphicon-phone"></span> 289-230-4510</p> <p><span class="glyphicon glyphicon-envelope"></span> aroncea@yahoo.com</p> </div> <div class="col-sm-7 slideanim"> <div class="row"> <div class="col-sm-6 form-group"> <input class="form-control" id="name" name="name" placeholder="name" type="text" required> </div> <div class="col-sm-6 form-group"> <input class="form-control" id="email" name="email" placeholder="email" type="email" required> </div> </div> <textarea class="form-control" id="comments" name="comments" placeholder="comment (not required)" rows="3"></textarea><br> <div class="row"> <div class="col-sm-12 form-group"> <input type="submit" name="submit" value="submit" /> </div> </div> </div> </div>
you missing }
in php-file. (you open {
after if
-statement never close it.)
with 500 errors, helps check servers error-log.
Comments
Post a Comment