.NET Email Functions

tehon3299

Centurion
Joined
Jan 6, 2003
Messages
155
Location
Liverpool, NY
I am using the following code:
Visual Basic:
		Sub Page_Load(sender as object, e as eventargs)
			Dim from As String = "tehonica@oswego.edu"
			Dim mailto As String = Session("email")
			Dim subject As String = "Tehon.Net Account Confirmation"
			Dim body As String = "Thank you for registering with [url]http://www.Tehon.Net[/url]"
			SmtpMail.SmtpServer = "mail.oswego.edu"
			SmtpMail.Send(from, mailto, subject, body)
		End Sub

This works perfect but I would like to now use the email address from an ASP textbox instead of hard coding it. How can I do this??

Thanks
 
To get the text of a textbox, use its Text property:

Visual Basic:
Dim mailto As String = myTextBoxName.Text

You may not want this code in the page's load event, because (I think)
the text of the TextBox will be its default when the page
loads. It makes more sense to have this code in the Click event of
a button, or something similar.
 
Back
Top