How to Write HTML Code for Someone to Subscribe to Newsletters

by Brandy Alexander

As a website creator, consider adding a newsletter subscription feature to your pages. This website element invites users to receive your mailings and you get notified when interested parties participate. In this way, you can build a mailing list that allows you to communicate your messages to a dedicated audience and it keeps these viewers interested in you site. Using HyperText Markup Language (HTML), write the code that allows your visitors to subscribe to your own newsletters.

1

Open a web page file in your text editor. Place your cursor in the area where you want to place the prompt for visitors to subscribe to your newsletter.

2

Type in opening and closing “<h1></h1>” header tags. Type content between these elements to tell the viewer what the prompt is for. For example:

<h1>Subscribe to My Newsletter</h1>

3

Enter a “<form>” tag. Inside the tag, set the “method” to “post,” the “enctype” to “text/html” and enter your email address after the “action” entry. For instance:

<form method=”post” enctype=”text/html” action=”mailto:youremail@something.com”>

This code line sends any subscription requests to you as an email message.

4

Type in an “email” entry. Enter an “<input>” tag with the “name” assigned to “email” and the “type” set to “text” as such:

Email <input name=”email” type=”text”>

This HTML line asks the user for his email address and provides a text field where he may enter the information.

5

Create a “Submit” button to allow the user to deliver her information to you by entering the following line of code:

<input type=”submit” value=”Submit”>

6

Type in an ending “</form>” tag to complete the code. Save your file when done.

Items you will need

About the Author

Brandy Alexander has been writing professionally since 2001. She is a glass artist with a Web design and technical writing background. Alexander runs her own art-glass business and has been a contributor to "Glass Line Magazine" as well as various online publications.