Не пойму в чем проблема? Первый раз верстаю форму, но она не работает, просто открывает в отдельном окне мою почту.
html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="preconnect" href="https://fonts.gstatic.com">
<link href="https://fonts.googleapis.com/css2?family=Do+Hyeon&display=swap" rel="stylesheet">
<link rel="stylesheet" type="text/css" href="style.css">
<link rel="stylesheet" href="./form.php">
<link rel="stylesheet" href="./skript.js">
<title>help</title>
</head>
<body>
<img class="photo" src="./141569648_876383399779901_1621986729866301818_n.jpg" alt="">
<p class="Author">Chornomaz Olga Olegovna <br>
educator of group №5
</p>
<form action="https://mail.google.com/mail/u/0/?tab=rm&ogbl#inbox.php" name="form" id="contact" class="decor" method="POST" target="_blank">
<div class="form-left-decoration"></div>
<div class="form-right-decoration"></div>
<div class="circle"></div>
<div class="form-inner">
<h3>Write a message</h3>
<input name="name" type="text" placeholder="Your name">
<textarea name="message" placeholder="Message..." rows="3"></textarea>
<input name="sab" type="submit" value="Send message">
</div>
</form>
</body>
js
jQuery(document).ready(function($) {
$("#contact").sub(function() {
var str = $(this).serialize();
$.ajax({
type: "POST",
url: "https://mail.google.com/mail/u/0/?tab=rm&ogbl#inbox.php",
data: str,
success: function(msg) {
if (msg =='OK') {
result = '<div class="ok">Your message has been sent</div>';
$("#fields").hide();
}
else {result = msg;}
$('#note').html(result);
}
});
return false;
});
});
php
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta charset="UTF-8">
<?php
$question125="Вопрос";
if (isset($_POST['name']) && $_POST ['name'] !="")
$name = $_POST['name'];
else die ("The field \" Name\"");
if (isset($_POST['message']) && $_POST ['message'] !="")
$body = $_POST['message'];
else die ("The field \"Message\"");
$address = "dimonkolomoetc@gmail.com";
$mes = "Name: $name \n";
$mes = "Message: $body";
$mes = "Message: $sab \n";
$note_text="Тема: $question125 \r\n Имя: $name \r\n
Дополнительная информация: $text";
if ($send)
echo "Message sent successfully!";
else
echo "Error, message not sent!";
?>