เขียนข้อความไม่ว่าจะเป็นภาษาไทยหรือภาษาอังกฤษ ส่งเมล์เข้า hotmail โดยใช้ ฟอร์ม sent mail ที่เขียนด้วย asp โดน hotmail block เหมือน mail เรามีไวรัส เป็นเพราะสาเหตุอะไรค่ะ Code ที่เขียนขึ้นค่ะ
Code (ASP)
<%@ Language=VBScript %>
<%
Option Explicit
%>
<%
' -----------------------------------------------------
function TestCaptcha(byval valSession, byval valCaptcha)
dim tmpSession
valSession = Trim(valSession)
valCaptcha = Trim(valCaptcha)
if (valSession = vbNullString) or (valCaptcha = vbNullString) then
TestCaptcha = false
else
tmpSession = valSession
valSession = Trim(Session(valSession))
Session(tmpSession) = vbNullString
if valSession = vbNullString then
TestCaptcha = false
else
valCaptcha = Replace(valCaptcha,"i","I")
if StrComp(valSession,valCaptcha,1) = 0 then
TestCaptcha = true
else
TestCaptcha = false
end if
end if
end if
end function
dim strName, strEmail, strMessage
strName = Request.Form("name") ' holds inputted name
strEmail = Request.Form("email") ' holds inputted email address
strMessage = Request.Form("message") ' holds inputted message
' -- check all fields for empty values --
' -- remove and add new as required --
if strName = "" then
Response.Redirect "contact.asp?action=err1"
else if strEmail = "" then
Response.Redirect "contact.asp?action=err2"
else if strMessage ="" then
Response.Redirect "contact.asp?action=err3"
else if TestCaptcha("ASPCAPTCHA", Request.Form("captchacode"))= false then
response.Redirect "errorcapcha.html"
Response.End
else
end if
end if
end if
end if
' -- begin email send process --
dim objMail
Set objMail = CreateObject("CDONTS.NewMail")
' -- email variables --
objMail.To = "[email protected]"
objMail.From = Trim(strEmail)
ob
objMail.BodyFormat = "0" ' HTML format
objMail.Body = "Name: " & Trim(strName) & vbCrLf _
& "E-Mail Address: " & Trim(strEmail) & vbCrLf _
& "Message: " & Trim(strMessage)
' -- send the email --
objMail.Send
' -- clean up object
Set objMail = Nothing
' -- execute confirmation page
Response.Redirect"thanks.html"
Response.End
%>