473,804 Members | 2,148 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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.P age


Protected Sub btnReset_Click( ByVal sender As Object, ByVal e As
System.EventArg s) Handles btnReset.Click
'Reset Fields
Me.txtName.Text = ""
Me.txtEMail.Tex t = ""
Me.txtCountry.T ext = ""
Me.txtComments. Text = ""
Me.ddlState.Sel ectedValue = ""
Me.cboxSubscrib e.Checked = False
Me.cblFavoriteG enre.SelectedIn dex = True
End Sub

Protected Sub btnSumbit_Click (ByVal sender As Object, ByVal e As
System.EventArg s) Handles btnSumbit.Click
'Get the information from the from
Dim strname As String = Me.txtName.Text
Dim stremail As String = Me.txtEMail.Tex t
Dim strstate As String = Me.ddlState.Tex t
Dim strcountry As String = Me.txtCountry.T ext
Dim strgenre As String = Me.cblFavoriteG enre.Text
Dim strcomments As String = Me.txtComments. Text
Dim strsubscribe As String = Me.cboxSubscrib e.Checked
Dim Subject As String =
Dim Body As String =

'Create an instance of the MailMessage class
Dim fromAdd As New MailAddress(str email, strname)
Dim toAdd As New MailAddress("dk *******@tx.rr.c om")
Dim msg As New MailMessage(fro mAdd, 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 + "strcomment s"
msg.Body = msg.Body + "strsubscri be"
Dim client As New SmtpClient("loc alhost")
client.Send(msg )

End Sub
End Class
Apr 26 '07 #1
2 1211
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*****@Idontt hinkso.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.P age


Protected Sub btnReset_Click( ByVal sender As Object, ByVal e As
System.EventArg s) Handles btnReset.Click
'Reset Fields
Me.txtName.Text = ""
Me.txtEMail.Tex t = ""
Me.txtCountry.T ext = ""
Me.txtComments. Text = ""
Me.ddlState.Sel ectedValue = ""
Me.cboxSubscrib e.Checked = False
Me.cblFavoriteG enre.SelectedIn dex = True
End Sub

Protected Sub btnSumbit_Click (ByVal sender As Object, ByVal e As
System.EventArg s) Handles btnSumbit.Click
'Get the information from the from
Dim strname As String = Me.txtName.Text
Dim stremail As String = Me.txtEMail.Tex t
Dim strstate As String = Me.ddlState.Tex t
Dim strcountry As String = Me.txtCountry.T ext
Dim strgenre As String = Me.cblFavoriteG enre.Text
Dim strcomments As String = Me.txtComments. Text
Dim strsubscribe As String = Me.cboxSubscrib e.Checked
Dim Subject As String =
Dim Body As String =

'Create an instance of the MailMessage class
Dim fromAdd As New MailAddress(str email, strname)
Dim toAdd As New MailAddress("dk *******@tx.rr.c om")
Dim msg As New MailMessage(fro mAdd, 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 + "strcomment s"
msg.Body = msg.Body + "strsubscri be"
Dim client As New SmtpClient("loc alhost")
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*****@Idontt hinkso.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
3499
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, because the dates must have quotes on each side. I just don't know how make the dates right. Well I'll just show you the code and some insert statements it generates. Could anyone please help me?
4
11556
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. thanks in advance, david ---------------
9
2418
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 single string separated by a user defined character. There is no error trapping (by design), USE AT YOUR OWN RISK.
7
3312
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 buffer into the character pointer. The code looks like the following: #include <stdio.h> #include <stdlib.h> #include "stdafx.h" BOOL APIENTRY DllMain( HANDLE hModule, DWORD ul_reason_for_call,
5
3796
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 List<RoleData> GetRoles() { return GetRoles(null, false); }
17
3421
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 it's "On Click" Event proceedure to Loop through my Database and find any records that fall within a Certain Date...if a record is found...it then emails me that a record
16
2545
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 uses IE to talk with a server. The user on the client (IE) sees an ASP net page containing a TextBox. He can write some text in this text box and push a submit button.
7
1876
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. I have found some interesting pages - interesting in the fact that they use javascript to encrypt the pages to block people from ?stealing thier content?. There are javascript tricks that you can use on the downloaded encrypted page to get...
0
5578
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 ******************************************************** For this teeny job, please refer to: http://feeds.reddit.com/feed/8fu/?o=25
12
2480
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 send contact info to email or data base when the "send" button is pressed. I've watched the tutorials over & over again. I just can't get it. Link: http://www.syfloristonline.zipa.com/contact_us.aspx. Need help
0
9712
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9594
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10089
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9171
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6862
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5530
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5673
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4308
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
3001
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.