<%@ LANGUAGE = VBScript %> <% Option Explicit %> <% ' 定数 Const SMTP_ADDRESS = "mail.vme.co.jp" Const MAIL_TO = "GolMu@vega-net.ne.jp" Const MAIL_FROM = "GolMu@vega-net.ne.jp" Const SUBJECT = "【Gol-Mu】オーダーフォーム" Const COMP_PAGE = "http://gol-mu.com/order_comp.html" Sub main() Set obj = Server.CreateObject("basp21") ' リクエスト取得 totalBytes = Request.TotalBytes binaryRead = Request.BinaryRead(totalBytes) If obj.Form(binaryRead, "next") <> "" Then Dim obj Dim totalBytes Dim binaryRead Dim body Dim targets Dim tgtNames Dim errMsgs() ReDim errMsgs(0) ' 必須項目チェック targets = "name,zip,address,tel,mail,music" tgtNames = "名前,郵便番号,住所,電話番号,メールアドレス,好きな音楽またはアーティスト" targets = Split(targets, ",") tgtNames = Split(tgtNames, ",") Call checkRequired(obj, binaryRead, errMsgs, targets, tgtNames) If Ubound(errMsgs) > 0 Then Call dispErr(errMsgs) Exit Sub End If ' メール送信 body = makeBody(obj, binaryRead) Call sendMail(body, errMsgs, obj) If Ubound(errMsgs) > 0 Then Call dispErr(errMsgs) Exit Sub End If ' エラーがなかった場合 Set obj = Nothing Response.Redirect COMP_PAGE End If Set obj = Nothing End Sub '************************************* ' メール本文作成 '************************************* Function makeBody(ByRef obj, ByRef binaryRead) Dim body Dim L_Crlf body = "" L_Crlf = "" + Chr(13) + Chr(10) body = body & "以下のオーダーメイド依頼が送信されました。" & L_Crlf body = body & "" & L_Crlf body = body & "名前 : " & obj.Form(binaryRead, "name") & L_Crlf body = body & "性別 : " & obj.Form(binaryRead, "sex") & L_Crlf body = body & "年齢 : " & obj.Form(binaryRead, "old") & L_Crlf body = body & "お住まい : 〒" & obj.Form(binaryRead, "zip") & _ " " & obj.Form(binaryRead, "address") & L_Crlf body = body & "電話番号 : " & obj.Form(binaryRead, "tel") & L_Crlf body = body & "メールアドレス : " & obj.Form(binaryRead, "mail") & L_Crlf body = body & "ゴルフ歴 : " & obj.Form(binaryRead, "history") & L_Crlf body = body & "HDCPまたは平均スコア : " & obj.Form(binaryRead, "score") & L_Crlf body = body & "好きなゴルファー : " & obj.Form(binaryRead, "golfer") & L_Crlf body = body & "好きな音楽またはアーティスト : " & obj.Form(binaryRead, "music") & L_Crlf body = body & "" & L_Crlf makeBody = body End Function %>