Hi!
I have a little problem you probably can help me with. I have created a contact form (by borrowing some code from a MS example and altering it) which sends mail to an address of my choice. It's working, but I want to add some more functions...
Since I'm totally new to
ASP (or APS.Net) I've run into something I can't figure out.
1) Where do I put the
Response.Redirect line to make it work?
I simply want the form filler to be directed to another page...
2) I've read about a
senton command, which I think can be used to include a time and date on the mail, but how?
My code is included below.
Kind regards,
Foobster
- Code: Select all
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd">
<%@ CodePage=65001 Language=VBScript %>
<HTML>
<HEAD>
</HEAD>
<BODY>
<%
' send by connecting to port 25 of the SMTP server
Dim iMsg
Dim iConf
Dim Flds
Dim strHTML
Dim strSmartHost
Const cdoSendUsingPort = 2
StrSmartHost = "smtpserver"
set iMsg = CreateObject("CDO.Message")
set iConf = CreateObject("CDO.Configuration")
Set Flds = iConf.Fields
' set the CDOSYS configuration fields to use port 25 on the SMTP server
With Flds
.Item("http://schemas.microsoft.com/cdo/con...tion/sendusing") = cdoSendUsingPort
.Item("http://schemas.microsoft.com/cdo/con...ion/smtpserver") = strSmartHost
.Item("http://schemas.microsoft.com/cdo/con...nectiontimeout") = 10
.Update
End With
' build HTML for message body
strHTML = "<HTML>"
strHTML = strHTML & "<HEAD>"
strHTML = strHTML & "<BODY>"
strHTML = strHTML & "Meddelandet kommer från " & Request.Form("namn") & "<br></br><br></br>"_
& "E-mail: " & Request.Form("email") & "<br></br><br></br>"_
& "Telefon: " & Request.Form("telefon") &"<br></br><br></br>"_
& "Vill ha mer information om " & Request.Form("angaende") & "<br></br><br></br>"_
& "Meddelande: " & "<br></br>" & Request.Form("meddelande")
strHTML = strHTML & "</BODY>"
strHTML = strHTML & "</HTML>"
' apply the settings to the message
With iMsg
Set .Configuration = iConf
.To = anyone@nowhere.com
.From = someone@anywhere.com
.Subject = Request.Form("namn") & " vill ha information om " & Request.Form("angaende")
.HTMLBody = strHTML
.Send
End With
Response.Redirect("tack.asp")
' cleanup of variables
Set iMsg = Nothing
Set iConf = Nothing
Set Flds = Nothing
%>
</BODY>
</HTML>