Wrox Home  
Search P2P Archive for: Go

  Return to Index  

aspx_beginners thread: Form Mailers


Message #1 by "Kristi" <kjohnson@i...> on Fri, 29 Mar 2002 22:31:09
What's the best way to take all of the data off of a web form and have it 
emailed to a specific address?
Message #2 by "Peter" <petemail@r...> on Fri, 29 Mar 2002 22:59:37 -0500
cdo object, I only know the old way using vbscript but you should be able to
translate to vb.

<% 'send a simple email using cdo

Set oMsg = Server.CreateObject("CDO.Message")

with oMsg
  .To = "user@d..."
  .CC = "user@d..."
  .From = "user@d..."
  .Subject = "Thank you for your feedback."
  .TextBody = "We will contact you with more information soon."
  .Send
end with

Set oMsg = Nothing  'release the object reference

%>

-----Original Message-----
From: Kristi [mailto:kjohnson@i...]
Sent: Friday, March 29, 2002 10:31 PM
To: aspx_beginners
Subject: [aspx_beginners] Form Mailers


What's the best way to take all of the data off of a web form and have it
emailed to a specific address?

Message #3 by "Minh T. Nguyen" <nguyentriminh@y...> on Sat, 30 Mar 2002 11:32:19 -0800
Kristi,

	You can post your form data from one page to the other, just as
you would in classic ASP. Then on the second form you can retrieve all
those form variables, just like you would in ASP. The syntax is a little
bit different, though:

	string name = Request.Form.Get("name")
	string toEmail = Request.Form.Get("to")
	string fromEmail = Request.Form.Get("from")
	string subject = Request.Form.Get("subject")
	string ....

	Then, you can send the email using the classes and methods
provided in the System.Web.Mail namespace:

	SmtpServer.SmtpServer = "mail.yourmailserver.com";
	SmtpServer.Send(fromEmail, toEmail, subject, body);

	or something like this.

Hope it works,
Minh.

-----Original Message-----
From: Kristi [mailto:kjohnson@i...] 
Sent: Friday, March 29, 2002 10:31 PM
To: aspx_beginners
Subject: [aspx_beginners] Form Mailers


What's the best way to take all of the data off of a web form and have
it 
emailed to a specific address?



_________________________________________________________

Do You Yahoo!?

Get your free @yahoo.com address at http://mail.yahoo.com




  Return to Index