Email Form – ASP

asp__logo-1

ASP Email Form

You can easily add limited email functionality to your ASP programs using the Message object. The Message object is not very feature intensive, but this lesson will show you how to implement a basic email form on your ASP site.

Experienced web masters might have noticed that whenever you put your email address onto the internet, so that your visitors can email you, you instantly get hit with tons of spam. This is most likely because a spammer’s email finder application saw your email address and added it to their nasty hit list.

You can receive emails from your visitors, without letting the general public know your email address, using what is taught in this lesson.

Quicky HTML Form

Before we start worrying about how to send the email, let’s make a basic HTML form that will gather the following information from the user:

  • From
  • To
  • Subject
  • Body

Our HTML file will be called “shareEmailForm.html” and should be saved in a directory that can Run ASP.

shareEmailForm.html Code:

<form method="POST" action="<span style="color: red;">shareEmail.asp</span>">
To <input type="text" name="To"/> <br />
From <input type="text" name="From"/> <br />
Subject <input type="text" name="Subject"/> <br />
Body <textarea name="Body" rows="5" cols="20" wrap="physical" > 
</textarea>
<input type="submit" />
</form>

ASP NewMail Object Death

Microsoft has made it rather confusing by changing their implementations of sending mail with ASP. In older ASP versions you would send mail with the NewMail Object. However, new versions of Microsoft’s Internet Information Services (IIS) software has changed again to instead use the Message object.

ASP Mail Processor

Now that we have our handy dandy HTML Form we need to create the ASP file that will retrieve this data and shoot off an email. All the properties that are set in the following code are self-explanatory and write only. Also, because Message is an object, it must be Set equal to nothing after we have finished with it to release the memory allocated to it.

The name of the ASP file is “shareEmail.asp” and should be saved to the same directory as “shareEmailForm.html”.

shareEmail.asp:

<%
'Sends an email
Dim mail
Set mail = Server.CreateObject("CDO.Message")
mail.To = Request.Form("To")
mail.From = Request.Form("From")
mail.Subject = Request.Form("Subject")
mail.TextBody = Request.Form("Body")
mail.Send()
Response.Write("Mail Sent!")
'Destroy the mail object!
Set mail = nothing
%>

Please note that this is a very basic ASP Email Form and is only for education purposes. If you were to put an email form on your web site you would want to do some checking to make sure the email addresses are valid, allow for attachments, etc.

Receive the most well-liked WordPress Plugin readily available today, you'll locate both free and superior plugins below. We have examined the whole web, reviewed hundreds of recommended Wordpress plugins and decided on the very best.
Get technology news the most up to date technology information, consisting of new product launches, revenues figures and tech market performance details. Go through write-ups on brand-new gizmos and prototypes for future innovation.
wordpress seo that you must and need to not be doing on your Websites to make them place higher in online search engine. In a constantly altering Search Engine Optimization garden, it is necessary to stay up-to-date with the transforming methods and techniques of optimization.
Below is a list of tools wordpress bulk manage in a main area. There are WordPress dash panels, in addition to multisite devices to take care of domains, motifs, campaigns, and a lot more. includes one-click gain access to, monitoring, data backup, implementation, posting, and safety functions. Review which of your sites have motifs and plugins that require focus. Along with one click, update all of your plugins, themes or center WordPress software.


My Name is Adi Saputra. I come from Indonesia. I want to develop www.tuto-rial.com Blog Being the best, So much of it as a reference in the world of IT in particular programming

Comments are closed.