473,378 Members | 1,679 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,378 software developers and data experts.

Help with Email Code

Hi!

I'm working on code for a feedback form. I want the data from the user
that is taken from the form to be emailed back to me. I'm using vb with
visual studios 2005.

I have most of the code, but have some missing stuff, because I'm not
totally sure what I'm doing!

Can someone take a look at this code and tell me what I'm missing.

Thanks!

Imports System.Net.Mail
Partial Class Feedback
Inherits System.Web.UI.Page


Protected Sub btnReset_Click(ByVal sender As Object, ByVal e As
System.EventArgs) Handles btnReset.Click
'Reset Fields
Me.txtName.Text = ""
Me.txtEMail.Text = ""
Me.txtCountry.Text = ""
Me.txtComments.Text = ""
Me.ddlState.SelectedValue = ""
Me.cboxSubscribe.Checked = False
Me.cblFavoriteGenre.SelectedIndex = True
End Sub

Protected Sub btnSumbit_Click(ByVal sender As Object, ByVal e As
System.EventArgs) Handles btnSumbit.Click
'Get the information from the from
Dim strname As String = Me.txtName.Text
Dim stremail As String = Me.txtEMail.Text
Dim strstate As String = Me.ddlState.Text
Dim strcountry As String = Me.txtCountry.Text
Dim strgenre As String = Me.cblFavoriteGenre.Text
Dim strcomments As String = Me.txtComments.Text
Dim strsubscribe As String = Me.cboxSubscribe.Checked
Dim Subject As String =
Dim Body As String =

'Create an instance of the MailMessage class
Dim fromAdd As New MailAddress(stremail, strname)
Dim toAdd As New MailAddress("dk*******@tx.rr.com")
Dim msg As New MailMessage(fromAdd, toAdd)
msg.Subject = "Feedback"
msg.Body = "strname"
msg.Body = msg.Body + "stremail"
msg.Body = msg.Body + "strstate"
msg.Body = msg.Body + "strcountry"
msg.Body = msg.Body + "strgenre"
msg.Body = msg.Body + "strcomments"
msg.Body = msg.Body + "strsubscribe"
Dim client As New SmtpClient("localhost")
client.Send(msg)

End Sub
End Class
Apr 26 '07 #1
2 1184
See
2/8/2006
Smarter Email/Smtp setup with DotNet Configuration Sections (1.1 and 2.0)

for some downloadable example code.
http://sholliday.spaces.live.com/blog/


"DrNoose" <dr*****@Idontthinkso.comwrote in message
news:46**********************@roadrunner.com...
Hi!

I'm working on code for a feedback form. I want the data from the user
that is taken from the form to be emailed back to me. I'm using vb with
visual studios 2005.

I have most of the code, but have some missing stuff, because I'm not
totally sure what I'm doing!

Can someone take a look at this code and tell me what I'm missing.

Thanks!

Imports System.Net.Mail
Partial Class Feedback
Inherits System.Web.UI.Page


Protected Sub btnReset_Click(ByVal sender As Object, ByVal e As
System.EventArgs) Handles btnReset.Click
'Reset Fields
Me.txtName.Text = ""
Me.txtEMail.Text = ""
Me.txtCountry.Text = ""
Me.txtComments.Text = ""
Me.ddlState.SelectedValue = ""
Me.cboxSubscribe.Checked = False
Me.cblFavoriteGenre.SelectedIndex = True
End Sub

Protected Sub btnSumbit_Click(ByVal sender As Object, ByVal e As
System.EventArgs) Handles btnSumbit.Click
'Get the information from the from
Dim strname As String = Me.txtName.Text
Dim stremail As String = Me.txtEMail.Text
Dim strstate As String = Me.ddlState.Text
Dim strcountry As String = Me.txtCountry.Text
Dim strgenre As String = Me.cblFavoriteGenre.Text
Dim strcomments As String = Me.txtComments.Text
Dim strsubscribe As String = Me.cboxSubscribe.Checked
Dim Subject As String =
Dim Body As String =

'Create an instance of the MailMessage class
Dim fromAdd As New MailAddress(stremail, strname)
Dim toAdd As New MailAddress("dk*******@tx.rr.com")
Dim msg As New MailMessage(fromAdd, toAdd)
msg.Subject = "Feedback"
msg.Body = "strname"
msg.Body = msg.Body + "stremail"
msg.Body = msg.Body + "strstate"
msg.Body = msg.Body + "strcountry"
msg.Body = msg.Body + "strgenre"
msg.Body = msg.Body + "strcomments"
msg.Body = msg.Body + "strsubscribe"
Dim client As New SmtpClient("localhost")
client.Send(msg)

End Sub
End Class

Apr 27 '07 #2
sloan wrote:
See
2/8/2006
Smarter Email/Smtp setup with DotNet Configuration Sections (1.1 and 2.0)

for some downloadable example code.
http://sholliday.spaces.live.com/blog/


"DrNoose" <dr*****@Idontthinkso.comwrote in message
news:46**********************@roadrunner.com...
>Hi!

Hi!

Thanks for the help! Got that part to work!!!!!
Apr 28 '07 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: duikboot | last post by:
Hi all, I'm trying to export a view tables from a Oracle database to a Mysql database. I create insert statements (they look alright), but it all goes wrong when I try to execute them in Mysql,...
4
by: David | last post by:
Hello , I'm trying to parse an XML document a get spicific tags such as email in the code below. I'm using xerces 2.4. However I don't manage to get the value for the email. Can anybody help. ...
9
by: hope | last post by:
Hi Access 97 I'm lost on this code please can you help ================================= Below is some simple code that will concatenate a single field's value from multiple records into a...
7
by: Timothy Shih | last post by:
Hi, I am trying to figure out how to use unmanaged code using P/Invoke. I wrote a simple function which takes in 2 buffers (one a byte buffer, one a char buffer) and copies the contents of the byte...
5
by: Learner | last post by:
Hello, Here is the code snippet I got strucked at. I am unable to convert the below line of code to its equavalent vb.net code. could some one please help me with this? static public...
17
by: Liam.M | last post by:
Hey guys, Forgive me if my question my be alittle silly, but I would very much appreciate and assistance that could be given! My situation is as follows: I have created a Button, and set...
16
by: pamelafluente | last post by:
I am still working with no success on that client/server problem. I need your help. I will submit simplified versions of my problem so we can see clearly what is going on. My model: A client...
7
by: smerf | last post by:
I am trying to write a personal spider to crawl through websites and create a highly specialized personal list of sites and pages that I may like to see based on preferences that I have supplied. ...
0
by: gunimpi | last post by:
http://www.vbforums.com/showthread.php?p=2745431#post2745431 ******************************************************** VB6 OR VBA & Webbrowser DOM Tiny $50 Mini Project Programmer help wanted...
12
by: =?Utf-8?B?ZGdvdw==?= | last post by:
I designed a "contact_us" page in visual web developer 2005 express along with EW2 after viewing tutorials on asp.net's help page. Features work like they should, but I cannot figure out how to...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.