How to Add a Subject Line in MailTo

Techwalla may earn compensation through affiliate links in this story.

Hyperlinks are one of the most important components of the World Wide Web. In most cases they connect one Web page to another. However, if you include the "mailto" attribute in the code used to generate a hyperlink, you can prompt a user's Web browser to create a new email message and pre-populate the address used in its "To" field. By adding an extra parameter you can also pre-populate the subject line of this message. Once you understand the proper syntax, adding the subject line becomes a quick and easy task.


Step 1

Open the Web page containing hyperlink with the "mailto" attribute, using either a visual Web design application or a text editing program.

Video of the Day

Step 2

View the HTML code that makes up your document. If you use a text editor, this code appears on-screen automatically. If you use a visual editing tool, manually switch to the program's "Code" or "HTML" mode.


Step 3

Locate the line of code that resembles the following:

Step 4

Add a question mark, the word "subject," and an equal-to sign to the line of code. Place them directly after the email address but before the closing quotation mark, without any spaces in between. The revised code should follow this pattern:


Step 5

Add your preferred subject line directly after the equal-to sign but before the closing quotation mark. You may include spaces between the words of the subject line, but not before the first word or following the last. The revised code should follow this pattern:


Step 6

Save your document to confirm the changes.