HTML Email Link

HTML Email Link

Sponsored Ads

It is very easy to put an email link in your web page so that people can send you mail directly.

Sponsored Ads

But the method is not so safe because there are people who uses bots to scan and collect email addresses from webpages. Later they use these mail address to send spam emails and our mail box will be filled with spam emails.

A safer method would be to use an html contact form and use some server side scripting like php to send mails.  You can see an example at the Tutorial Manthra contact us page. Your will learn about the html forms in the later chapters.

You can learn about php in another tutorial.

But if you want to use the email link in webpage you have other safer options like Google recaptcha to reveal the email only after confirming that you are a human.

HTML Email Tag

HTML <a> tag provides you option to specify an email address to send an email. While using <a> tag as an email tag, you will use mailto: email address along with href attribute. Following is the syntax of using mailto instead of using http.

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

Output

Sponsored Ads

Send Email

Now, if you click on this link, it launches one Email Client like Outlook Express etc. installed on your computer.

Another risk in using this option to send email is if user did not install email client on their computer then it would not be possible to send email.

Default Settings

You can also specify a default email subject and email body with your email address in the code.

Example

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

Sponsored Ads

Output

Send Feedback

Sponsored Ads

%d bloggers like this: