Dreamweaverを使用してウェブサイトを作成していますが、私のウェブサイトにはフォームがありますが、送信ボタンをクリックすると、メールクライアントを経由せずに自分のアカウントにメールを送ることが可能かどうか疑問に思っていました。これは私のコードです...Htmlフォームを提出すると、電子メールに直接送信されます
私はすべてのコードを編集するためにDreamweaverを使用しています。
<!doctype html>
<html lang="en-US">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Fiction Filming</title>
<link rel="shortcut icon" href="images/favicon3.ico" type="image/x-icon" />
<style type="text/css">
body {
background-color: #2c2c2c;
}
</style>
<link href="Css/singlePageTemplate.css" rel="stylesheet" type="text/css">
<!--The following script tag downloads a font from the Adobe Edge Web Fonts server for use within the web page. We recommend that you do not modify it.-->
<script>var __adobewebfontsappname__="dreamweaver"</script>
<script src="http://use.edgefonts.net/source-sans-pro:n2:default.js" type="text/javascript"></script>
<!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->
<!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
<!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script>
<script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
<![endif]-->
</head>
<body>
<!-- Main Container -->
<div class="container">
<!-- Navigation -->
<!-- Hero Section -->
<!-- About Section -->
<!-- Stats Gallery Section -->
<div class="gallery"><img src="Images/Newbannercomingsoon.png" alt="" width="1000" height="500" class="logo-pic"/> </div>
<!-- Parallax Section -->
<!-- More Info Section -->
<!-- Footer Section -->
<section class="footer_banner" id="contact">
<form class="subscribeForm form-fix" name="Subscription Form" method="post" action="mailform.php" enctype="text/plain">
<div class="newform">
<div> </div>
<div>
<input id="fname" type="text" placeholder="NAME" name="name" required>
</div>
<div>
<input name="email" type="email" required id="email" placeholder="EMAIL">
</div>
<div>
<select name="select" required id="myselect">
<option>HELP/SUPPORT</option>
<option>BUSINESS ENQUIRES</option>
<option>OTHER</option>
</select>
</div>
<div class="text-form">
<div>
<textarea name="textarea" required id="textarea" placeholder="TYPE YOUR TEXT HERE"></textarea>
</div>
</div>
<br><input name="Send" type="submit" id="Send" value="Send">
</div>
</form>
<!-- Step 1: Add an email field here -->
<!-- Step 2: Add an address field here -->
<!-- Step 3: add a submit button here -->
</section>
<!-- Copyrights Section -->
<div class="copyright">©2016 - <strong>Fiction filming</strong></div>
</div>
<!-- Main Container Ends -->
</body>
</html>
また、ここに私のPHPファイルです...あなたがそれを修正することができれば、本当に役に立ちます。 HERE
<!doctype html>
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset="UTF-8">
<META HTTP-EQUIV="refresh" content="0;URL=thankyou.html">
<title>Email Form</title>
</head>
<body>
<?php
if(isset($_POST['submit'])){
$to = "[email protected]"; // this is your Email address
$from = $_POST['email']; // this is the sender's Email address
$sender_name = $_POST['name'];
$select = $_POST['select'];
$message = $sender_name . " wrote the following:" . "\n\n" . $_POST['textarea'];
$headers = "From:" . $from;
$headers2 = "From:" . $to;
mail($to,$subject,$message,$headers);
echo "Mail Sent. Thank you " . $name . ", we will contact you shortly.";
// You can also use header('Location: thank_you.php'); to redirect to another page.
}
?>
</body>
</html>
formタグでuは=がアクションとしてアクションを述べたのでNEW PHP
<!doctype html>
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset="UTF-8">
<META HTTP-EQUIV="refresh" content="3;URL=thankyou.html">
<title>Email Form</title>
</head>
<body>
<?php
if(isset($_POST['submit'])){
// Or the below if using "name="Send" for the input. Uncomment and get rid of the above
// if(isset($_POST['Send'])){
if(!empty($_POST['email'])
&& !empty($_POST['name'])
&& !empty($_POST['select'])
&& !empty($_POST['textarea'])) {
$to = "[email protected]";
$from = $_POST['email'];
$sender_name = $_POST['name'];
$select = $_POST['select'];
$textarea = $_POST['textarea'];
$message = $sender_name . " wrote the following:" . "\n\n" . $textarea;
if(mail($to,$subject,$message,$headers)){
echo "Mail was sent. Check both your inbox and spam, as mail as done its job.";
}
else{
echo "There was a problem. Check your logs.";
}
}
}
// $headers = "From:" . $from;
// $headers2 = "From:" . $to;
//echo "Mail Sent. Thank you " . $name . ", we will contact you shortly.";
// You can also use header('Location: thank_you.php'); to redirect to another page.
//}
?>
</body>
</html>
ここにかなりの問題があります –
誰も見つからない –
ええ?彼らは何であると言うことができますか? –