Reply
ASP.Net Email form
Old 12-11-2007, 12:56 PM ASP.Net Email form
Silent77's Avatar
Ultra Talker

Posts: 255
Name: Silent
Location: Ohio
I am currently using ASP.Net and I am trying to make an contact form on a webpage (contact.aspx) and I want the contact form to send the values of the text boxes to my email address in an email. I was trying to use smtp and such but I couldn't get any of it to work because I was told I would have to use IIS on my webhost. So does anyone have a light weight email contact form? Thank You.
__________________
Firefox
rediscover the web
Get Firefox today it's free! Down with internet explorer!
Silent77 is offline
Reply With Quote
View Public Profile Visit Silent77's homepage!
 
When You Register, These Ads Go Away!
Old 12-12-2007, 05:27 AM Re: ASP.Net Email form
chrishirst's Avatar
Super Moderator

Posts: 13,626
Location: Blackpool. UK
It's CDOSYS you need to use for sending SMTP emails on a Windows host.

function for sending the message;
http://www.candsdesign.co.uk/article...-email/cdosys/ written in ASP VbScript though
__________________
Chris. ->> Links are advertising NOT optimising!! <<-
Indifference will be the downfall of mankind, but who cares?
Code Samples | People Counting System
chrishirst is offline
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Old 02-15-2008, 09:31 PM Re: ASP.Net Email form
ozzozo's Avatar
Experienced Talker

Latest Blog Post:
Customer Support Whitepaper
Posts: 44
Try this:

http://www.developer.com/net/asp/article.php/3096831
__________________
Universal FAQ Manager - FAQ Management Software
ozzozo is offline
Reply With Quote
View Public Profile Visit ozzozo's homepage!
 
Old 03-01-2008, 08:09 AM Re: ASP.Net Email form
Novice Talker

Posts: 5
Name: Scott Baldridge
Location: Nashville, TN
This works for me:

Dont forget this reference
Imports System.net.Mail

This is the code behind:
Private Sub ClearControls()
ddlContact.SelectedIndex = 0
txtMessage.Text = ""
txtName.Text = ""
txtEmail.Text = ""
txtPhone.Text = ""
End Sub
Private Sub SendMessage()
Try
Dim emFrom As String = txtEmail.Text
Dim emTo As String = ddlContact.SelectedValue
Dim MailObj As New MailMessage
MailObj.From = New MailAddress(emFrom)
MailObj.To.Add(emTo)
MailObj.Body = ("From:" & txtName.Text & "<br>" & " Message: " & txtMessage.Text)
MailObj.IsBodyHtml = True
Dim smtp As New SmtpClient("whatever your hosting provider gives you")
smtp.Send(MailObj)
ClearControls()
lblMessage.Visible = True
lblMessage.Text = "Thank you for your message! We will be in contact with you as soon as possible."
Catch
lblMessage.Text = "We are sorry but your message did not go through. Please call us for assistance @ 555-555-5555."
End Try
End Sub
Protected Sub btnClear_Click(ByVal sender As Object, ByVal e As System.Web.UI.ImageClickEventArgs) Handles btnClear.Click
Response.Redirect("Contact.aspx")
End Sub
Protected Sub btnSend_Click(ByVal sender As Object, ByVal e As System.Web.UI.ImageClickEventArgs) Handles btnSend.Click
Page.Validate()
If Page.IsValid Then
SendMessage()
End If
End Sub
GoGetSome is offline
Reply With Quote
View Public Profile Visit GoGetSome's homepage!
 
Reply     « Reply to ASP.Net Email form
 

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off




   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML

 


Page generated in 0.14403 seconds with 12 queries