Şimdiden teşekkürler.
Yapmaya çalıştığım şey resimdeki gibi
Yani alanadına teklif vermek isteyen site@mailuzantisi.com , Teklifi şeklinde
ancak kod sadece maili yazınca çalışıyor , ve tutar kısmını eklemek gerekiyor.
Bu şekilde sorunsuz olarak çalışıyor
Ancak ben böyle olmasını istiyorum
JS kodu:
/*
notifyMe jQuery Plugin v1.0.0
Copyright (c)2014 Sergey Serafimovich
Licensed under The MIT License.
*/
function explode(){
$(".block-message").addClass("").removeClass("show-block-valid show-block-error");
$(".message").fadeOut();
}
(function(e) {
e.fn.notifyMe = function(t) {
var r = e(this);
var i = e(this).find("input[name=email]");
var s = e(this).attr("action");
var o = e(this).find(".note");
e(this).on("submit", function(t) {
t.preventDefault();
var h = i.val();
var p = /^(([^<>()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*)|(\".+\"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;
if (p.test(h)) {
$(".message").removeClass("error bad-email success-full");
$(".message").hide().html('').fadeIn();
$(".fa-spinner").addClass("fa-spin").removeClass("opacity-0");
o.show();
e.ajax({
type: "POST",
url: s,
data: {
email: h
},
dataType: "json",
error: function(e) {
o.hide();
$(".fa-spinner").addClass("opacity-0").removeClass("fa-spin");
$(".block-message").addClass("show-block-error").removeClass("show-block-valid");
if (e.status == 404) {
$(".message").html('Service is not available at the moment. Please check your internet connection or try again later.
').fadeIn();
var myTimeout = setTimeout(explode, 4000);
} else {
$(".message").html('Oops. Looks like something went wrong. Please try again later.
').fadeIn();
var myTimeout = setTimeout(explode, 4000);
}
}
}).done(function(e) {
o.hide();
if (e.status == "success") {
$(".fa-spinner").addClass("opacity-0").removeClass("fa-spin");
$(".message").removeClass("bad-email").addClass("success-full");
$(".block-message").addClass("show-block-valid").removeClass("show-block-error");
$(".message").html('Congrats! You are in list. We will inform you as soon as we finish.
').fadeIn();
var myTimeout = setTimeout(explode, 4000);
} else {
if (e.type == "ValidationError") {
$(".fa-spinner").addClass("opacity-0").removeClass("fa-spin");
$(".message").html('This email address looks fake or invalid. Please enter a real email address.
').fadeIn();
var myTimeout = setTimeout(explode, 4000);
} else {
$(".fa-spinner").addClass("opacity-0").removeClass("fa-spin");
$(".message").html('Oops. Looks like something went wrong. Please try again later.
').fadeIn();
var myTimeout = setTimeout(explode, 4000);
}
}
})
} else {
$(".fa-spinner").addClass("opacity-0").removeClass("fa-spin");
$(".message").addClass("bad-email").removeClass("success-full");
$(".block-message").addClass("show-block-error").removeClass("show-block-valid");
$(".message").html('Your e-mail address is incorrect. Please check it and try again.
').fadeIn();
var myTimeout = setTimeout(explode, 4000);
o.hide();
}
// Reset and hide all messages on .keyup()
$("#notifyMe input").on('keyup keypress', function(e) {
var code = e.keyCode || e.which;
if (code == 13) {
e.preventDefault();
$("#notifyMe").submit();
} else {
clearTimeout(myTimeout);
$(".block-message").addClass("").removeClass("show-block-valid show-block-error");
$(".message").fadeOut();
}
});
})
}
})(jQuery)
PHP Kodu:
header('content-type: application/json');
$o = new stdClass();
$o->status = 'success';
echo json_encode($o);
$email_to = "myemail@email.com"; // Replace by your email address
$email = $_POST["email"];
$text = "Congratulations ! A new person wants to be alerted when your site will be online: $email";
$headers = "MIME-Version: 1.0" . "\r\n";
$headers .= "Content-type:text/html; charset=utf-8" . "\r\n";
$headers .= "From:<$email>\n";
mail($email_to, "Message", $text, $headers);
?>