The following code, is for inputing info to a e-mail address how do i run this asp page in same file? <% If Ҡ& request(“sendâ€) = “true†then set msg = Server.CreateObject("CDONTS.NewMail") msg.BodyFormat = 0'mail_format msg.MailFormat = 0'mail_format msg.Subject = request(“subjectâ€) msg.Body = request(“msgâ€) msg.From = "info@dm.com" msg.To = “dm@hotmail.com†msg.Send() end if %> <form action=“thispage.asp?send=true†method=post> <input type=text name=â€subjectâ€> <textarea rows=5 cols=50 name=msg></textarea> <input type=submit> </form>
If you put all that into one file it should probably work. The only problem I can see that would prevent it from working is this line: If Ҡ& request(“sendâ€) = “true†then Code (markup): It should probably read: If request(“sendâ€) = “true†then Code (markup): Also, the quotes you are using are not code-friendly. They should be replaced with "straight quotes like this" instead.
Try this: <% If Request.Form("msg") <> "" then set msg = CreateObject("CDO.Message") msg.From = "info@dm.com" msg.To = "dm@hotmail.com" msg.Subject = request.form("subject") msg.TextBody = request.form("msg") msg.Send set msg = nothing response.write("<p>message sent!</p>") end if %> <form name="frmsend" action="<%=Request.ServerVariables("URL")%>" method="post"> <input type="text" name="subject"><br /> <textarea rows="5" cols="50" name="msg"></textarea><br /> <input type="submit" value="Send Message"> </form> Code (markup): Put that in a .ASP file, and it'll all work automatically. It doesn't matter what the ASP file is called.
Hi.. Try this.. Sending mail with different options! http://www.expertsforge.com/Web-Development/Tutorial-12.asp