Hello,
Can anyone help me troubleshoot this problem:
This code suppose to work in someone else server, but when I place in my own server this code doesn't work I wonder why?
I am using smtp.gmail.com and port 587.
contact.php
<!DOCTYPE html>
<html lang="en">
<head>
<!-- Basic -->
<meta charset="utf-8">
<title>Ritmo - Mobile App Landing Page HTML5 Template</title>
<meta name="author" content="DSA79">
<meta name="norobots" content="noindex,nofollow">
<meta name="keywords" content="responsive, html5 template, one page, landing, startup, business, company, corporate, creative">
<meta name="description" content="Crossway - Startup Landing Page Template">
<!-- Libs CSS -->
<link href="css/style.css" rel="stylesheet" type="text/css" />
<link href="css/bootstrap.css" rel="stylesheet" type="text/css" />
<link href="css/green.css" rel="stylesheet">
<link href="css/darkorchid.css" rel="stylesheet">
<link href="css/darkred.css" rel="stylesheet">
<link href="css/darkblue.css" rel="stylesheet">
<link href="css/wheat.css" rel="stylesheet">
<link href="css/turquoise.css" rel="stylesheet">
<link href="css/lightgreen.css" rel="stylesheet">
<link href="css/honeydew.css" rel="stylesheet">
<link href="css/darkpink.css" rel="stylesheet">
<!-- Google Fonts -->
<link href='http://fonts.googleapis.com/css?family=Raleway:400,100,200,300,500,600,700,800,900' rel='stylesheet' type='text/css'>
</head>
<body>
<div id="contentForm">
<?php
header('Content-Type: text/html');
if(isset($_POST['email'])) {
// EDIT THE 2 LINES BELOW AS REQUIRED
$email_to = "squprime@gmail.com";
$email_subject = "SquPrime Free trial request!";
$first_name = $_POST['first_name']; // required
$email_from = $_POST['email']; // required
$phone = $_POST['phone']; // required
$email_message = "Form details below.\n\n";
function clean_string($string) {
$bad = array("content-type","bcc:","to:","cc:","href");
return str_replace($bad,"",$string);
}
$email_message .= "Name: ".clean_string($first_name)."\n";
$email_message .= "Email Address: ".clean_string($email_from)."\n";
$email_message .= "Phone Number: ".clean_string($phone)."\n";
// create email headers
$headers = 'From: '.$email_from."\r\n".
'Reply-To: '.$email_from."\r\n" .
'X-Mailer: PHP/' . phpversion();
@mail($email_to, $email_subject, $email_message, $headers);
?>
<!-- Message sent! (change the text below as you wish)-->
<div class="container">
<div class="row">
<div class="col-sm-6 col-sm-offset-3">
<div id="form_response" class="text-center">
<img class="img-responsive" src="img/thumbs/mail_sent.png" alt="image" />
<h1>Congratulations!!!</h1>
<p>Thank you <b><?=$first_name;?></b>, your message is sent!</p>
<a class="btn btn-theme btn-lg" href="index.php">Back To The Site</a>
</div>
</div>
</div>
</div>
<!--End Message Sent-->
<?php
}
?>
</div>
</body>
</html>
I already try ping to smtp.gmail.com from my server and the ping is okay.
Thanks before.