<%@ LANGUAGE = VBScript %> <% Option Explicit %> <% ' 定数 Const SMTP_ADDRESS = "mail.vme.co.jp" Const MAIL_TO = "uprize@uprize.jp" Const MAIL_FROM = "uprize@uprize.jp" Const SUBJECT = "【Gol-Mu】お問い合わせフォーム" Const COMP_PAGE = "http://gol-mu.com/inquiry_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,mail,body" 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, "mail") & L_Crlf body = body & "お問い合わせ内容 : " & obj.Form(binaryRead, "body") & L_Crlf body = body & "" & L_Crlf makeBody = body End Function %>