■index.html(送信Form入力画面)

<html> 
<head> 
<meta http-equiv="content-type" content="text/html;charset=Shift_JIS"> 
<title>わたなべ和装製作所 問い合わせForm</title>
<script language="javascript">
function RequiredCheck()
{
    // E-MAILアドレス入力チェック
    if (trim(document.getElementById('email').value) == "" )
    {
        alert('お客様のE-MAILアドレスを入力してください');
        document.getElementById('email').focus();
        return false;
    }
 
    // メッセージ入力チェック
    if ( trim(document.getElementById('message').value) == "" ) 
    {
        alert('お問い合わせ内容を入力してください');
        document.getElementById('message').focus();
        return false;
    }
 
    // 入力チェックOK
    return true;
}
 
// ブランクカット
function trim(targetValue) { 
    if ( targetValue == "" ) { return ""; }
    return targetValue.replace(/(^\s*)|(\s*$)/g, ""); 
} 
</script>
</head> 
 
<body>
 
<form name="form1" 
      action="sendmail_acept.php" 
      method="post" 
      onSubmit="return RequiredCheck()">
 
    <table border="0" cellspacing="2" cellpadding="5">
        <tr>
            <td>*お客様のE-MAILアドレス</td>
            <td>
                <input type="text" id="email" name="email">
            </td>
        </tr>
        <tr>
            <td>*お問い合わせ内容</td>
            <td>
                <textarea id="message" name="message" cols="30" rows="5"></textarea>
            </td>
        </tr>
        <tr>
            <td colspan="2" align="center">
                <br><br>
                <input type="submit" id="acept" name="acept" value=" 確 認 ">
                &nbsp;&nbsp;
                <input type="reset" id="reset" name="reset" value="入力内容を消去">
            </td>
        </tr>
    </table>
 
</form>
 
</body>
</html>

 

 

■sendmail_acept.php(送信前確認画面- PHPです)

<html> 
<head> 
<meta http-equiv="content-type" content="text/html;charset=Shift_JIS"> 
<title>わたなべ和装製作所 問い合わせForm</title> 
</head> 
 
<body>
 
<form name="form1" 
      action="sendmail_exec.php" 
      method="post">
 
    <h1>わたなべ和装製作所 お問い合わせ</h1>
 
    <h3>この内容で送信しますか?</h3>
 
    <table border="0" cellspacing="5" cellpadding="5">
        <tr>    
            <td  nowrap valign="top">お客様のE-MAILアドレス</td>
            <td  nowrap valign="top">
            <?php 
                print $_POST['email'];
            ?>
            <input type="hidden" name="email" id="email" value="<?php echo $_POST['email']; ?>">
            </td>
        </tr>
        <tr>    
            <td valign="top">お問い合わせ内容</td>
            <td valign="top">
<pre>
<php? 
print $_POST['message'];
?>
</pre>
            <input type="hidden" name="message" id="message" value="<?php echo $_POST['message']; ?>">
            </td>
        </tr>
        <tr>
            <td colspan="2" align="center">
                <br><br>
                <input type="submit" name="send" id="send" value=" 送 信 ">
                &nbsp;&nbsp;
                <input type="button" name="back" id="back" value=" 戻 る " onClick="javascript:history.back(-1);">
            </td>
        </tr>
    </table>
 
</form>
</body>
</html>

 

■sendmail_exec.php(問い合わせ内容メール送信-PHPです)

<?php
 
//エンコーディング指定
mb_language("japanese");
mb_internal_encoding("SHIFT_JIS");
 
// 送信先
to = "mio@techbank.jp";
 
// 題名(Subject)
$subject = "わたなべ和装製作所 問い合わせメール(Web)";
 
// 本文
$body = $_POST['message'];
 
// 送信元
$from = $_POST['email'];
 
 
// メール送信実行
if (mb_send_mail($to,$subject,$body,"From:".$from)) {
    // 送信成功
    require_once("sendmail_ok.htm");
}
else {
    // 送信失敗
    require_once("sendmail_ng.htm");
}
 
?> 
 

 

■sendmail_ok.htm(送信完了画面)

<html>
<head>
<title>わたなべ和装製作所 問い合わせ完了</title> 
</head>
<body>
    <h1>送信が完了しました。</h1>
    <h3>後日、担当のものより、ご連絡差し上げます。</h3>
    <h3>ありがとうございました</h3>
 
    <a href="http://www.localhost.com/">わたなべ和装製作所のTOPページに戻る</a>
</body>
</html>

 

■sendmail_ng.htm(送信エラー画面)

<html>
<head>
<title>わたなべ和装製作所 問い合わせ失敗</title>
</head>
<body>
 
    <h1>送信エラーが発生しました。</h1>
    <h3>お手数をお掛けいたしますが、再度お問い合わせ内容をご入力頂くか、</h3>
    <h3>または、<a href="mailto:mio@localhost.jp">mio@localhost.jp</a> までお問い合わせ下さい</h3>
 
    <a href="index.html">再度、問い合わせ内容を入力する</a>
    <a href="http://localhost.com/">わたなべ和装製作所のTOPページに戻る</a>
 
</body>
</html>