the code works correctly in sending mail , auto reply visitor. when form submitted page nothing , sits on same page form still filled out. not redirecting browser "thank you" page.
i have spend hours on trying resolve , cant life of me figure out why wont redirect.
please help!
<?php require $_server['document_root'].'/assets/class.phpmailer.php'; session_start(); date_default_timezone_set('europe/london'); $time = date("d/m/y @ h:i:s", time()); $referer = $_server['http_referer']; $ip = $_server['remote_addr']; $sendfrom = "admin@example.com"; $sendname = "senders name"; $name = $_post['visitor-name']; $subject = $_post['visitor-subject']; $email = $_post['visitor-email']; $message = $_post['visitor-message']; $phone = $_post['visitor-phone']; $mail = new phpmailer(true); $mail->smtpdebug = 0; $mail->issmtp(true); $mail->host = "localhost"; //hostname of mail server $mail->port = '25'; //port of smtp 25, 80, 465 or 587 $mail->clearreplytos(); $mail->addreplyto($email, $name); $mail->setfrom($sendfrom, $name); //from address , name $mail->addaddress($sendfrom); //to address $mail->subject = ("web form: $subject"); $mail->body = "message"; $mail->ishtml(true); //auto reply if($mail->send()){ $automail = new phpmailer(true); $automail->smtpdebug = 0; $automail->issmtp(true); $automail->host = "localhost"; //hostname of mail server $automail->port = '25'; //port of smtp 25, 80, 465 or 587 $automail->clearreplytos(); $automail->addreplyto("sales@example.com", $sendname); $automail->setfrom($sendfrom, $sendname); //from address , name $automail->addaddress($email); //to address $automail->subject = "thank recent enquiry"; $automail->body = "auto reply message"; $automail->ishtml(true); if($automail->send()) { header("location: success.php"); exit; } } ?>
//$mail->smtpdebug = 0;
that helped me
Comments
Post a Comment