-2

私は外部の電子メールに投稿する必要がある単純なHTMLフォームを持っています:vynora2011@hotmail.comこのように:

<form method="post" action="mailto:vynora2011@hotmail.com" ENCTYPE="text/plain">
                <label for="Name">Naam:</label>
                <input type="text" name="Name" id="Name" />

                <label for="City">Plaats:</label>
                <input type="text" name="City" id="City"  />

                <label for="Email">Email:</label>
                <input type="text" name="Email" id="Email" />

                <label for="Message">Bericht:</label>
                <textarea name="Message" rows="5" cols="20" id="Message"></textarea>

            <input type="submit" name="submit" value="Bericht verzenden" class="submit-button" />
            </form>

例:JsFiddle

メールをチェックしてもメッセージが表示されません。

4

1 に答える 1

1

PHP (またはその他の言語) が必要です。機嫌がいいので、あなたのためにやります。このコードをコピーして貼り付けるだけです:

  <?php 
if ($_POST["email"]<>'') { 
    $ToEmail = 'vynora2011@hotmail.com'; 
    $EmailSubject = 'Mail Subject'; 
    $mailheader = "From: ".$_POST["email"]."\r\n"; 
    $mailheader .= "Reply-To: ".$_POST["email"]."\r\n"; 
    $mailheader .= "Content-type: text/html; charset=iso-8859-1\r\n"; 
    $MESSAGE_BODY = "Name: ".$_POST["name"].""; 
    $MESSAGE_BODY .= "Email: ".$_POST["email"]."";
    $MESSAGE_BODY = "City: ".$_POST["city"].""; 
    $MESSAGE_BODY .= "Message: ".nl2br($_POST["message"]).""; 
    mail($ToEmail, $EmailSubject, $MESSAGE_BODY, $mailheader) or die ("Failure"); 
?>
    Your message has been send. 
    <?php 
} else { 
?>
    <form id="contato-main" action="index.php" method="post">
      <input id="name" name="name" type="text" required="required" placeholder="Naam"/>
      <input id="email" name="email" type="text" required="required" placeholder="E-Mail" />
      <input id="city" name="city" type="text" placeholder="Plaats"/>
      <textarea id="message" name="message" required="required" placeholder="Bericht></textarea>
      <br />
      <input id="submit" type="submit" name="Submit" value="Submit" />
    </form>
    <?php 
}; 
?>

もちろん、(css) のニーズに合わせて編集してください。また、「$EmailSubject = '' 内の「メールの件名」を任意のものに編集します。

于 2013-01-16T12:27:57.860 に答える