html - Issues with PHP contact form (won't send inquiries to my email) :( -
i'm having difficult time trying find error in php form. edited in every possible way , form submits on website, never in receipt of sent form email. kind on code below mail.php form? tia
amanda
<? require("class.phpmailer.php"); //form validation vars $formok = true; $errors = array(); //sumbission data $ipaddress = $_server['remote_addr']; $date = date('d/m/y'); $time = date('h:i:s'); //form data $name = $_post['name']; $email = $_post['email']; $subject = $_post['subject']; $message = $_post['message']; $mail = new phpmailer(); $mail->issmtp(); // send via smtp $mail->host = "smtp.gmail.com"; // smtp server $mail->smtpauth = true; // turn on smtp authentication $mail->smtpsecure = 'tls'; $mail->username = "dont.reply.m@gmail.com"; // smtp username $mail->password = "password"; // smtp password $mail->from = "dont.reply.m@gmail.com"; // smtp username $mail->addaddress("mypersonalemail@msn.com"); // address $mail->subject = "new message website!"; $mail->ishtml(true); $mail->charset = 'utf-8'; $mail->body = "<p>you have recieved new message contact form on website.</p> <p><strong>name: </strong> {$name} </p> <p><strong>email address: </strong> {$email} </p> <p><strong>subject: </strong> {$subject} </p> <p><strong>message: </strong> {$message} </p> <p>this message sent ip address: {$ipaddress} on {$date} @ {$time}</p>"; if(!$mail->send()) { echo "mail not sent <p>"; echo "mailer error: " . $mail->errorinfo; exit; } echo "mail sent"; ?>
try add $mail->port = 587 , refer following link.sometimes $mail->smtpsecure should ssl in case o gmail other tls
this complete reference send email using gmail settings
Comments
Post a Comment