Sending email using PHPMailer PHP Syntax error? -
hey guys trying use php mailer send email through contact form on website.
i used these settings.
if (empty($errors)) { $m = new phpmailer; $m->issmtp(); $m->smtpauth = true; $m->host = 'smtp.gmail.com'; $m->username = 'myemail@gmail.com'; $m->password = 'its correct password'; $m->smtpsecure = 'ssl'; $m->port = 465; $m->ishtml(); $m->subject = 'submission of contact form'; $m->body = 'from:' . $fields['name'] . ' (' . $fields['email'] . ')<p>' . $fields['message'] . '</p>'; $m->fromname = 'contact'; $m->addaddress('myemail@gmail.com', 'myname'); if ($m->send()) { header('location: thanks.php'); die(); } else { $errors[] = 'sorry, try again later.'; } }
i new php, seems have syntax error somewhere prevents email being sent. when inspect page 302 found , 200 ok working fine.
what missing in code?
Comments
Post a Comment