J-mail og required/missing_fields_redirect
Hvordan kan jeg lave det sådan at der er nogle felter i formen som skal være udfyldt før der kan sendes?Hvis de ikke er udfyldt skal der redirectes til en fejlside.
Fomse:-)
Her er koden:
<%@LANGUAGE = VBSCRIPT%>
<html>
<body>
<%
' Get the form data
subject = "Rekvirering af " & Request.Form("subject")
navn = Request.Form("navn")
gade = Request.Form("gade")
postnr = Request.Form("postnr")
tlf = Request.Form("tlf")
email = Request.Form("email")
kommentar = Request.Form("kommentar")
' Create the JMail message Object
set msg = Server.CreateOBject( "JMail.Message" )
' Set logging to true to ease any potential debugging
' And set silent to true as we wish to handle our errors ourself
msg.Logging = true
msg.silent = true
' Enter the sender data
msg.From = email
msg.FromName = navn
' Note that as addRecipient is method and not
' a property, we do not use an equals ( = ) sign
msg.AddRecipient "me@myself.com"
' The subject of the message
msg.Subject = subject
' And the body
msg.body = "Navn = " & Request.Form("navn") & vbcrlf
msg.body = msg.body & "Gade = " & Request.Form("gade") & vbcrlf
msg.body = msg.body & "Postnr = " & Request.Form("postnr") & vbcrlf
msg.body = msg.body & "Tlf = " & Request.Form("tlf") & vbcrlf
msg.body = msg.body & "Email = " & Request.Form("email") & vbcrlf
msg.body = msg.body & "Kommentar = " & Request.Form("kommentar") & vbcrlf
msg.body = msg.body & "Ønsker at bestille = " & Request.Form("subject") & vbcrlf
' Now send the message, using the indicated mailserver
if not msg.Send("smtp.tiscali.dk" ) then
Response.write "<pre>" & msg.log & "</pre>"
else
Response.write "Message sent succesfully!"
end if
' And we're done! the message has been sent.
%>
</body>
</html>
