HTML Email Links


This is very easy to put an HTML email link on your page. But while doing so, you need to put your email address on your web page which can cause a spamming problem for your email account. There are many guys over the internet who can run programs to harvest these types of emails for spamming. So if you are going to put your email link on a public website then you have be prepared for anti-spamming as well.
You can have another option to facilitate people to send you emails. This option is to use HTML forms to take user data and then use CGI script to send an email.
A simple example, check our Contact Us Form. We take user feedback using this form and then we are using one CGI program which is collecting this information and sending email to one given email ID.
You will learn about HTML Forms in HTML Forms and you can learn about CGI in our another tutorial PERL & CGI.

HTML Email Tag:

HTML <a> tag provides you facility to specifiy an email address to send an email. While using <a> tag as an email tag then you will use mailto:email address along with href attribute. Following is the syntax of using mailto instead of using http.
<a href= "mailto:abc@example.com">Send Email</a>
This code will generate following link:
Send Email
Now if a user will click this link then it will lanuch one Email Client ( like Lotus Notes, Outlook Express etc. ) installed on your user's computer.
This is another risk to use this procedure because if users do not have email client installed on their computer then it would not be possible to send you email.

Default Email Subject and Body:

You can specify a default email subject and email body alongwith your email address. Following is the example to use default subject and body.
<a href="mailto:abc@example.com?subject=Feedback&body=Message">
Send Feedback
</a>
This code will generate following link:
Send Feedback

Post a Comment

Previous Post Next Post