以下を使用して、経由でメールを送信していますajax
。送信していませんname
。
var submitForm = function(){
var name = jQuery('[name=name]').val();
var email = jQuery('[name=email]').val();
var gender = jQuery('[name=gender]').val();
$.ajax({
url: 'http://domainname.com/Email.php',
data: {name: name, email: email, phone: phone, gender: gender},
type: 'POST',
success: function ( data ) {
$(".rhino-container").html("Dear <b>"+name+"</b> You have applied successfully, Our career counseller will get in touch with you.");
}
});
};
以下はemail.php
:
<?php
$name = $_POST['name'];
$email = $_POST['email'];
$gender = $_POST['gender'];
$to = 'yourdomain@gmail.com';
$from = $email;
$subject = 'Apply Online Details from a user as below---';
$body = "Hello Admin<br><br>
Name: <strong>$name</strong><br>
Email: $email<br>
Phone: $phone<br>
Gender: $gender<br>
";
$headers = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
$headers .= "From: $from";
$ok = mail($to, $subject, $body, $headers);
if($ok)
echo '1';
else
echo '0';
?>