I want to be able to have people subscribe and unsubscribe from my mailing list.

<%@ Language=VBScript %>
<HTML>
<HEAD>
<title>Test Email Form</title>
</HEAD>
<BODY>
<center>
<%

If Request.Form("email") <> "" Then
 Dim Mailer
 Set Mailer = Server.CreateObject("CDONTS.NewMail")
 Mailer.From    = Request.Form("email")
 Mailer.To      = "newsletter-REQUEST@yourdomain.com"  'your mailing list address with -REQUEST
 'Mailer.Cc      = ""
 Mailer.Subject = Request.Form("subject")
 Mailer.BodyFormat=0
 Mailer.MailFormat = 0 
 Mailer.Body = ""

 Mailer.Send

 If Request.form("subject") = "Subscribe" then 
  Response.Write("<font color=green><b>Thank you for for subscribing to our mailing list! You will receive a confirmation email shortly.<b></font>")
 else
  Response.Write("<font color=Red><b>Your address will be immediately removed from our mailing list. You will receive a confirmation email shortly.<b></font>")
 end if
 set Mailer=Nothing
Else
%>
Unsubscribe your email from the mailing list...
<form name="unsubscribe" method="post" action="subscription.asp">
<table>
<tr><td>Email Address: </td><td><input type="text" name="email">
</td></tr>
</table><br>
<input type=hidden value="Unsubscribe" name="subject">
<input type="submit" value="Unsubscribe">
</form>
<br>
Subscribe to our mailing list!
<form name="subscribe" method="post" action="subscription.asp">
<table>
<tr><td>Email Address: </td><td><input type="text" name="email">
</td></tr>
</table><br>
<input type=hidden value="Subscribe" name="subject">
<input type="submit" value="Subscribe!">
</form>
<%
End If
%>
</center>
</BODY>
</HTML>

 

 
  • 0 Users Found This Useful
Was this answer helpful?

Related Articles

Where can I find documentation for ServerObject's AspMail component?

This documentation can be found at: http://www.serverobjects.com/products.html For...

How do I upload files through my web pages?

You can use Software Artisan's SAFileUP. This is an ASP component that allows you to upload files...

What is PageCounter and how do I use it?

About Page Counter PageCounter is an object that counts and displays the number of times a Web...

How do I setup Microsoft Outlook Express to read my e-mail?

Follow these steps: Open Microsoft Outlook Express. From the Tools menu, click...

How do I setup Netscape Messenger to read my e-mail?

Follow these steps: Open Netscape Navigator. Click the Edit menu and then click Preferences......