Web Technologies - HTML

Back to Course

Lesson Description

Lession - #150 HTML Email Links

It is not difficult to include an HTML email link on your website, however it may result in unwanted spamming of your email account. There are persons who can run programmes that capture these sorts of emails and then utilise them for spamming in a variety of ways.
You have another option to make it easier for individuals to send you emails. One alternative would be to collect user data using HTML forms and then send an email using a PHP or CGI script.
Check out our Contact Us Form as an example. We collect user input using this form, and then we utilise a CGI software to collect this information and deliver it to the one provided email address.
Note − HTML Forms will teach you about HTML Forms, and CGI will teach you about CGI some of our other course Perl CGI Programming.

HTML Email Tag

When using the HTML <a> tag to send an email, you can specify an email address. You will utilise the mailto: email address and the href attribute when utilising the <a> tag as an email tag. When utilising mailto instead of http, the syntax is as follows.

<a href = "mailto: abc@example.com">Send Email</a>

This code will produce the email address below, which you may use to send an email.
Send Email

When a user clicks on this link, it activates an Email Client (such as Lotus Notes, Outlook Express, or others>
that is installed on your user's machine. There is additional danger to using this option to send email since it is not feasible to send an email if the user does not have an email client installed on their machine.

Default Settings

Along with your email address, you may provide a default email topic and email body. The following is an example of how to utilise the default subject and body.

<a href = "mailto:abc@example.com?subject = Feedback&body = Message"></a>
Send Feedback

This code will produce the URL below, which you can use to send an email.

Send Feedback