
RSS Underground - RSS Resources - Dynamic Directory - Article MenuFeatured RSS Underground Content Article{ASP.NET} - Emailing Form ContentOne of the problems that I first encountered when I was learning the ropes was that a book can never tell you everything. So as I was struggling to learn the development techniques that I apply, I had to frequently rely on online resources or forums to get the job done. This was not easy, especially when you are trying to solve a problem and all you get is errors. So, one of my goals with my weblog was to help all of you out there who are struggling to get on your feet with new technologies. It's kind of like repayment for all those out there who have helped me and still continue to help me learn. So today, I want to show you how it is possible to email form content to yourself or another person using the asp.net postback feature and a little creativity. I am assuming that your reading this post because you have a form with the runat="server" attribute and well formed server controls already ready to go. Server controls take quite a long time to explain so if you don't already have your form ready to go, I suggest you read up on the many tutorials available that can teach you about server controls. So how is it possible to do this on the page. Well once you understand how it works, you'll never forget how simple it is. First you have to make sure your button server control has the attribute OnClick. The value for OnClick will be equal to the value of the Sub control that will send the email. The value I selected for the OnClick attribute is "SendEmail". Here's what it looks like: In the code section at the top of the page, make sure you import the right Namespace so that the right classes will load with the page. The only one for this task that you have to worry about is the System.Web.Mail Namespace. For vb users, the correct usage just below the page attribute at the top of the page is this:
For the Sub which should follow the OnClick selection and have the same name should start like this: <blockquote> Sub SendEmail(Sender As Object, e As EventArgs) </blockquote> Then we define the entire message as one variable Dim: <blockquote> Dim msg as String </blockquote> And for each line in the message you start it off with the name of the variable and followed by the "+=" sign to add it to the variable. Then for text that you want to display like a label or header or something, you make sure that it is enclosed in quotation marks and for variables that you are bringing into the massage (ie: for the text from a taxtbox in the form that you want mail, you make sure that you include the technical name for that selection. For instance, let me write out a couple lines of code so you can see how it all works and then I'll describe the details so you can understand:
<blockquote> Dim msg as String msg+="Form mailer header" & vbcrlf msg+="Contact Name : " & contactname.Text & vbcrlf msg+="Contact Email : " & email.Text & vbcrlf msg+="Agree To Terms : " & terms.SelectedValue & vbcrlf </blockquote> Now I've included a couple of different items here so you can understand. First, I made sure I included the call on the variable: <blockquote> Dim msg as String</blockquote> This is so you can begin to put the pieces together. Then I included one line that I want as full text and include no values from the form. <blockquote> msg+="Form mailer header" & vbcrlf</blockquote> Notice I included something new: vbcrlf. This tells the parser to create a new line in the email. Everything that is text is fully enclosed in the quotation marks and there is a space between that and the character &, then there is another space and the vbcrlf code. This would make one complete line in your email message. <blockquote> msg+="Contact Name : " & contactname.Text & vbcrlf </blockquote> The next line is a mix of two different items. First we have some text that we want to display, then the value of one of the items from the form. This is separated by spaces and the & character and the item from the form is now listed as contactname.Text. The text portion help the server identify that the text that was in the server control with the id of "contactname" is what is needed to be placed there. The next line is also similar to this. <blockquote> msg+="Agree To Terms? " & terms.SelectedValue & vbcrlf </blockquote> The final value that I've listed in this example is similar, but has a different suffix for the id information that you want to pass along. Instead of .Text, it has .SelectedValue. This takes the place of the .Text suffix when you have a drop-down server control or multiple choice selection, as in the case of a group of radio buttons. This would identify the selected value from that group. There is also another one for this specific case and that is .SelectedIndex. This gives a number instead of the value. It's the number of the value in the order they are presented in the list. So if I have a list of three possible answers or selection, and they choose the second one down, the .SelectedIndex would return the number 2 instead of the text for that selection. This is especially helpful if you are querying a database, but that'll be saved for another lesson. So once you have your entire message laid out line by line we'll create another variable which will actually help to pull everything together and define the direction of the message variable "msg". <blockquote> Dim MailObj as New MailMessage </blockquote> This actually puts all the various pieces together. Under that, you need to add a few variables. The System.Web.Mail class that we imported into the file will be able to identify these and utilize them properly. <blockquote> MailObj.To=johnpwooton@gmail.com <-put your email address, I added mine to give you an example. MailObj.FROM=email.text <- specify an email address in quotes or include the declaration for the server control that is passing along the address. MailObj.SUBJECT="Form Mail" MailObj.BODY=msg MailObj.BodyFormat = MailFormat.Text SmtpMail.SmtpServer ="your.smtpserver.com" <- your smtp server address. You must have this to send the message. SmtpMail.Send(MailObj) <-tells the Sub to send the message. </blockquote> You can also add an optional redirect to another page that tells them the form mailer was a success by using this before you end the Sub: <blockquote> Response.Redirect("thankyou.aspx") </blockquote> and of course, you have to end the Sub properly: <blockquote> End Sub</blockquote> So that's it. Pure and simple. Of course if you have any questions, post a comment and I'll do what I can to help you out. I have used this particular script on other pages on my sites and it has worked very well. Related: Relevant Content Writing - Web Content Writing RSS Underground Featured Article Author BoxAuthor and Creator, The SEO Journal Blog http://seojournal05.blogspot.com New Video Content and Syndication TacticsResearch shows that people want to switch from watching television to videos via the Internet on their computers, handhelds and other devices. And Content Propulsion Lab, a Division of Content Desk, a major player in provisioning high-quality content for web publishers, is right there at the forefront leading Internet marketers and others interested in the creation and syndication of video content. "The tools that enable broadcast quality video production and syndication are practically free these days," said Mark Braunstein, Founding Partner of Content Desk at ContentDesk.com, and of Content Propulsion Lab at ContentPropulsionLab.com. "So the Playing field has been leveled with the networks...and now your next door neighbor with the webcam could become the next big internet celebrity." Content Propulsion Lab offers tools, resources, webinars, and continuous training for all types of content creation and syndication. Their members can focus on making and syndicating their own videos, articles, podcasts, audios and more - with all the tools, technology, strategy and training in one place, freeing up lots of time, energy, money and focus. And the timing couldn't be better. Research from the Points North Group and Horowitz Associates in "Internet Users Lined Up for Video," by Enid Burns, March 2, 2006, Incisive Interactive Marketing LLC., 2006, shows that: -"TV Junkies" are anticipating rich video content from providers like Yahoo! and Google. - One-third of those surveyed said they were interested in Google Video and some 41% leaned towards the launch and growth of Yahoo! Go service. - Downloading versus streaming will become more of an issue, as well as the focus on variety in the range of offerings; video formats for computers, laptops, PDAs, iPods and other devices. Savvy Internet marketers who prepare now with the tools and strategies of the future will be at a greater advantage for broader promotional campaigns and sales strategies to increase their bottom lines. And with tools and learning strategy for video creation, not to mention article syndication, podcasting, audio streaming and more - all in one place, successful Internet marketing will be a breeze, or click, for those who take the time to learn and keep up with fast-paced new media growth and expansion. "The buzz of a viral internet video can make you an online business success if you know what you're doing," added Braunstein. He teaches members of Content Propulsion Lab how to create and syndicate content online.
Growth of 100+ with Sample Video Content Propulsion Lab member Kelvin Brown has been experimenting with video lately. His latest creation netted 100 video plays in one day. "Almost any content can be turned into video, exceptable to google and other sources," said Kelvin Brown of www.InternetMarketingDungeon.com . His video shows people how to create redirects (links that will direct someone to another site), also known as tiny URLs, for free. It's online at Google at: http://video.google.com/videoplay?docid=609842448626428300 Learn more by visiting Content Propulsion Lab at http://www.contentlabinfo.com or emailing support@contentdesk.com Related: Public Domain Content - Money Making Mini Site RSS Underground Featured Article Author BoxBy Diana Barnum, CEO of http://OhioHelpGroup.com & president of http://MovingAheadCommunications.com for help with marketing, public relations and writing. Subscribe to blogs for Free tips: http://movingaheadblog.com & http://fridaybizoppreport.com or call: (614) 529-9459 Hey, please visit the Internet Marketing web sites: Recently Added Internet Related Articles: Creating Quality Content - In the western side of the world and in developed countries, many business establishments have not only their physical building present in the business area but also their online stores. Everyone who has access to the internet can buy almost everything that he needs. Clothes, gifts items, book, CDs, VCD, DVDs, and even the food that he wants to eat, he can buy it on the internet. Content Writers - According to prolific copywriter Nick Usborne, a survey conducted among the readers of his email newsletter "Excess Voice," which is available at nickusborne.com, offers some interesting results. They seem to be split almost three ways: one-third consists of copywriters, another content writers and the final third both. Article Marketing - To the search engines, content is king. However if your whole site is cluttered with content, it can look really boring and might scare your visitors away. Identify Your Audience Do you really need to unclutter the content of your site? The answer to this question will depend on what type of web audience you are targeting. Content Update Management - The difference between online marketing and offline marketing though is profound. Although advertising can be very effective offline, it isn't nearly so effective online. The reason why that is most people surf the internet looking for information. Targeted Content - According to SearchEngineWatch.com, a recent survey of businesses using the Internet as a primary marketing tool reported that only 11% said SEO gave a lower return on investment than search advertising. More importantly, 35% said that SEO was more valuable in terms of return on investment than paid advertisement. Management Web Content - Information is very vital in today technology based world. Organizations are faced with the massive task of having to structure and effectively present information to their customers and business interests. Putting forth their product and services related information across the internet is seen as the best way to reach out to a global audience. RSS Resources - RSS resources for webmasters that is Highly Relevant and Search Engine Friendly! Blogger Name - Blogging is really hot and yet many people still have no idea what it is or what it's for. I usually get one of two responses when I tell people that I recently launched a weblog : 'A what?' or 'Great, where can I find it?' It seems people are either completely aware and involved with blogging or unaware of its existence. Don't be left behind and miss out on a fabulous opportunity to connect with more potential clients and partners. Internet Blogging - Blogging is the latest buzzword in the Internet. Blogging descends from the word web log. Blog is actually a message board, wherein you can post thoughts and opinions to be read by others. A large number of audiences view a weblog . You need to register to a weblog through your user id and password. In some cases, you even do not need a password to read a weblog . Articles on the web
How To Make Money Using Your Opt In List |
RSS Feeds
XML
Dynamic
Content
Sitemaps
News
Feeds
Blogging
Content
For
Webmaster

RSS Underground - RSS Resources - Dynamic Directory - Article Menu
© 2007, © 2007 RSS Underground