Goodies to Go (tm)
March 31, 2003-- Newsletter #226
WEBINAR: On-demand webcast
How to Boost Database Development Productivity on Linux, Docker, and Kubernetes with Microsoft SQL Server 2017 REGISTER >
Goodies to Go (tm)
March 31, 2003--Newsletter #226
This newsletter is part of the internet.com network.
Featured this week:
* Goodies Thoughts - Email Forms With
* Q & A Goodies
* News Goodies
* Goodies Peer Reviews
Just in case you missed it before, the new Beyond HTML Goodies book is now available!
Goodies Thoughts - Email Forms With ASP
Last week I discussed ways to handle email forms using a couple of common
technologies. This week I present a solution using one more technology, namely
ASP. I have included a complete sample page with all code in place for you to
try out. In case you missed last week's newsletter, you can find it in the
archive at http://www.htmlgoodies.com/letters/225.html This solution, being an
ASP solution, will only work for those of you who have your sites hosted on a
First, let me add a little additional thought to the mix. I mentioned in the introductory paragraph last week that email forms are frequently used to send messages back to the webmaster and are sometimes used as a mechanism for capturing data, bypassing the need for a local database. This is the point I'd like to touch on again; it appears to have piqued the curiosity of more than a few readers!
It is easy enough to imagine the kinds of data that can usefully be captured on a form. "Tell me who you are", "tell me what you like", "tell me what I can do for you", "tell me what you want from me"; these are all good examples. It is very convenient to simply add this data to a local database, for whatever later processing you have in mind, but it is not always that easy. Not every host will make a database available to you, at least, not for free! If you could capture the data another way, and get it back to your own computer where you could put it into a database yourself, that might be a good workable solution.
If you format all the captured data into the body of an email and send it to yourself, you could cut and paste the data either directly into a database (depending on the capabilities of your database management system) or into a text file for later import into your database (which almost every DBMS can do.) Since you as the programmer are completely responsible for the format of your email, you can determine how you need it to look. It's also worth remembering that when you capture your data in this way, your email box becomes a back-up for your data!
This solution uses Microsoft's Collaboration Data Objects (CDO) for NT Systems (CDONTS). CDONTS is a library designed to enable SMTP (Simple Mail Transport Protocol -- email) messaging. It is usually installed on NT or W2K systems, but should it be missing, it can be installed by adding the SMTP feature to the Internet Information Services (IIS) on the server (your host will understand this - or at least, they should!)
Here is the example:
<%@ Language=VBScript %>
Dim sEmailAddr, sMsg
On Error Resume Next
sEmailAddr = Request.Form("EmailAddress")
If Len(sEmailAddr) > 0 Then
If InStr(1,sEmailAddr,"@") > 0 Then
sMsg = "Please enter a valid email address."
If Err.number <> 0 Then
sMsg = Err.Description
On Error Resume Next
Set oMail = Server.CreateObject("CDONTS.NewMail")
.From = "Testing@TestDomain.com"
.To = sEmailAddr
.Subject = "Testing Website"
.Body = "This is only a test"
Set oMail = Nothing
If Err.number <> 0 Then
sMsg = Err.Description
<%If Len(sMsg) > 0 Then%>
<form id="frmTest" name="frmTest" method="post" action="TestEmail.asp"> <P align="center">
Enter your email address
<input id="EmailAddress" name="EmailAddress" type="text" size="30" maxlength="64" value="<%=sEmailAddr%>">
<input id="btnSend" name="btnSend" type="submit" value="Send"> </P> </form>
<%If Len(sEmailAddr) > 0 And Len(sMsg) = 0 Then%>
Your Email was sent successfully.
That's the whole thing! This one assumes it is in a file called "testemail.asp". You can create a file with this name, copy it into a directory on your website and try it out! If you choose to call the file something else, you will need to change the action="TestEmail.asp" near the bottom to reflect the name you choose (of course, it must end ".asp")
Around the middle, you see a line with :
.From = "Testing@TestDomain.com"
This is the address the email appears to be sent from. You can change this to ad address suitable for your needs. It is also possible that your host's email service has some restrictions on the domain name that is used in this email address. If you have doubt, or if you have problems, check with your hosting company.
A full explanation of this code is far beyond the scope of this newsletter, but if you read it carefully, you'll probably get the idea of what it is doing. You can get more information about ASP in our tutorials on http://www.htmlgoodies.com Another way to exploit it is to first get it working on your site, then slowly make changes to it, trying each change out to verify that it works, and slowly evolving it into something you find useful.
Thanks for Reading!
- Vince Barnes
Questions are taken from submissions to our Community Mentors. You can ask a Mentor a question by going to http://www.htmlgoodies.com/mentors.
Q. I have created two pages one for high res and other for low resolutions, and want to create a "splash" page that will show some content while redirect the user to the correct resolution main page. This is the code I4m using to redirects the user to the correct res page. I need to add a delay of X seconds so the user can see the content of "splash" page before being redirected. How can i do this?
A. You could use setTimeout() to perform a function to redirect after so many milliseconds. Here is an example that will redirect to the specified link after 2000 milliseconds (2 seconds):
Q. (Re. Search Engine Submissions) I typically submit my sites using the tool provided by my web host. That's not because I want to, but more because I'm confused by all the 'services' out there that offer site submission - from $24.95/month to $500 one time fee for software that promises to submit, analyze and everything else in between other than fixing my breakfast. Before spending money on anything that I'm solicited to via email and ads on sites that I visit, I wonder if anyone might have a suggestion on a site submission tool that is really worth the money spent.
A. I am not a search engine/marketing guru be any means. I tell my clients up front that I do not guarantee a good placement in any search engine. There are people that do just website marketing and get paid very well. I do, however use this site to submit the websites of my clients: http://selfpromotion.com Another site I use for information is: http://www.sitepoint.com It has a lot of information about web sites from coding to marketing. I don't know if you are interested in PPC (Pay Per Click) marketing, but I suggest you take a look at http://www.overture.com It has a really nice tool for seeing the amount of times a certain keyword was searched for in the previous month. It may help your META tags.
[There is a lot of information about all aspects of Search Engines, including a submission service, at http://www.searchenginewatch.com - Ed.]
Q. I saw a script on your site for random quotes. I've been searching your site and the rest of the net for this script, but haven't been able to find it. I need a script where I can have 26 random quotes.
Q. I am using a simple dropdown box to select a page on my site:
what I want to do is have it go to the selected page (eg. 2002.htm) when an option is selected. I would prefer a "Go" button when selection is made.
A. Just add the input tag with a submit button at the bottom of your select box code:
<input type="submit" value="GO"></input>
Stocks: A Weak End To The Week
[03/28/03 - 06:00 PM]
Stocks fell again Friday on fears of terrorism and a protracted war in Iraq.
Game Market Watch - The Gathering
[March 31, 2003] Jupitermedia's inaugural gamer's conference takes a deep look into the crystal ball of the industry and sees nothing but dollar signs.
Red Hat Unveils 9
[March 31, 2003] The company releases Red Hat Linux 9, positioning it as an ideal Linux platform for students, home computing and technology enthusiasts.
Lawmaker Wants to Ax E-Rate Program
[March 31, 2003] Colorado congressman calls fee to provide discounted Internet service to schools and libraries an 'unfair, unauthorized' tax.
Microsoft Beefs Up Wi-Fi Security in XP
[March 31, 2003] Microsoft releases a free XP download with support for Wi-Fi Protected Access, an alternative to the WEP protocol.
Trial Date Nears in eBay Patent Case
[March 31, 2003] After a series of motions and hearings, the infringement case filed by MercExchange appears likely to be aired in court; eBay's 10-K treats the potential outcome as a serious business risk.
AOL Launches Enhanced Broadband Service
[March 31, 2003] ISP launches new effort to coax more high-speed subscribers over to its service by dangling a bundle of exclusive content, software services and integrated messaging.
More Headaches for Sendmail
[March 31, 2003] A remotely exploitable vulnerability in the open source message transfer agent leaves the Sendmail organization scrambling over the weekend to prevent attacks on unpatched servers.
AOL May Have to Restate $400 Million
[March 29, 2003] More trouble out of AOL Time Warner's online unit related to how it accounted for advertising deals with media company Bertelsmann.
Microsoft to Send Server 2003 to Manufacturers
[March 28, 2003] UPDATE: After delaying the product for more than a year and a half, the company ships its new server operating system to manufacturers.
Every week a site selected each week for review. Each week, reviews of the previous week's selected site are chosen for publication on the HTML Goodies website.
The current week's selected site is published in Goodies To
Go and in the Peer Reviews section of the website.
Current contact email addresses for submitting your site and
for submitting reviews are published in Goodies To Go.
If you would like to have your site reviewed, sign up for the Goodies To Go newsletter in the Navigation Bar on the left side of this page.
For full details about this program, see http://www.htmlgoodies.com/peerreviews
Did you ever wish your newsletter was an easy two way communications medium? Ploof! It now is!
If you would like to comment on the newsletter or expand/improve on something you have seen in here, you can now send your input to:
We already receive a lot of email every day. This address will help us sort out those relating specifically to this newsletter from all the rest. When you send email to this address it may wind up being included in this section of the newsletter, to be shared with your fellow readers. Please don't send your questions to this address. They should be sent to our mentors: see http://www.htmlgoodies.com/mentors/
Iain Truskett wanted to respond to my reference to Matt's formmail.pl script. He (and a few other writers) expressed concern because they know that there is a better version of formmail.pl available from the nms project. I did mention the concerns for the exploits of the script, which Matt also recognizes, but I hadn't realized that the latest version is not available on his site - I try to give credit to the actual (original) author wherever possible. Thanks to Iain and to all who wrote in to point out the location of the latest versions. To share the info, it's at: http://nms-cgi.sourceforge.net/
Matthew Dingley also wanted you to know that a PHP solution is also possible. He has written a program that can help with this. He as it on a website at http://www.matthewdingley.co.uk/programs/contact/index.ph -- I've not tried it out myself, but I'm sure Matthew will be happy to help you out if you need more info.
And Remember This . . .
On this day in...
1889 Eiffel Tower Opens
Gustave Eiffel himself presided over the ceremony to dedicate and open the famous Paris landmark. He designed the tower as his entry (the winner, obviously) in a competition for the design of a monument to commemorate the hundredth anniversary of the French Revolution. Eiffel, a bridge builder and master of metal construction, was also the designer of the frame of the Statue of Liberty which had been given to the United States and placed in the entrance to New York Harbor. Twenty years later, the lease on the land on which it stood expired and the tower was to be dismantled. It was spared, however, only because it was useful as a tower for radio antennas. It has remained almost unchanged ever since.
Born today were: in 1735, the composer ("Father of the Symphony") Franz Josef Haydn; 1935, band leader and trumpet player Herb Alpert - and on the same day, actor Richard Chamberlain; 1943, actor Christopher Walken; 1948, former US Vice President Al Gore and on the same day, actress Rhea Perlman
Thanks for reading Goodies to Go!
Archive Home Page.