Help - Search - Members - Calendar
Full Version: POST data and sending email with ASP
Invision Power Services > Community Forums > Community Web Design and Coding
Jeremy-
I'm using the following code in ASP to send mail, but how do I go about using POST data for the fields?

CODE
<%
      Dim obCDO
      Set obCDO = Server.CreateObject("CDO.message")
         with obCDO
          .From = "test@test.net"
          .To = "support@test.net"
          .Subject = "Test"
          .TextBody = "testing"
          .Send()
         end with
%>


Basically, I need to the "To", "Subject", and "TextBody" fields use data posted from a form. How can I go about that?
Stephen
Use Request.Form("fieldname") for POST data and Request.QueryString("fieldname") for GET data.

Also just so you know Request.Cookies("name") for cookie data and Request.ServerVariables("name") for server variables
Cool Surfer
QUOTE(Jeremy- @ May 11 2005, 12:22 PM) *
I'm using the following code in ASP to send mail, but how do I go about using POST data for the fields?

CODE
<%
      Dim obCDO
      Set obCDO = Server.CreateObject("CDO.message")
         with obCDO
          .From = "test@test.net"
          .To = "support@test.net"
          .Subject = "Test"
          .TextBody = "testing"
          .Send()
         end with
%>


Basically, I need to the "To", "Subject", and "TextBody" fields use data posted from a form. How can I go about that?


What OS ru using ? Its very important to know if you want to send emails using ASP. You need CDONTS
for it to function, or else it wont work. Windows Xp doesnt support CDONTS. Install a chillisoft asp server
if you are using Windows Xp. OR USE NT version of windows - Windows NT4, Windows 2000 or Windows Server2003.
Jeremy-
@ Stephen: Thanks, man! That's just what I was looking for. original.gif

@ Cool Surfer: I had the form working (Windows 2000) if I put in the text manually, it would submit everything. I just had to fix it to use POST data.
sbauer
QUOTE(Cool Surfer @ May 12 2005, 12:17 PM) *
What OS ru using ? Its very important to know if you want to send emails using ASP. You need CDONTS
for it to function, or else it wont work. Windows Xp doesnt support CDONTS. Install a chillisoft asp server
if you are using Windows Xp. OR USE NT version of windows - Windows NT4, Windows 2000 or Windows Server2003.

Not completely true. CDONTS is not installed, but CDOSYS is. CDOSYS (CDO.Message) was implemented beginning with Windows 2000. CDONTS was left in Win2k for legacy code. If you have the SMTP service installed, it should work (assuming you are using the localhost as the SMTP server).
System.Web.Mail in the .NET framework essentially wraps the cdonts.dll and cdosys.dll libs (depending on the OS version).
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2009 Invision Power Services, Inc.