How to create a link to send email on HTML page?

By Faruque Ahamed Mollick

You can see on many sites like this link. Whenever you click the link, you will able to send an email that is given using the backend HTML code. There the email address is already set to someone’s email.

So how can you do it? How can you create a link like that where someone clicks and able to send an email.

Below is the HTML code for creating a mailto link:

<a href="mailto:[email protected]">Email to us</a>

It will create a link like this:  Email to us.



After clicking it you can see an email sending box with the email [email protected] that is already filled up in the box where you want to send an email.

Was that not so easy? Now let’s see with some more advanced code.

Email link with already filled up subject box

Here is another link. Click this link and you will see the subject box is also filled up with a text that. The text is given in the HTML code.

below is the code which adds mailto link with email subject:

<a href="mailto:[email protected]?subject=Email Subject Here">Email To Us</a>

Now test this HTML code. After clicking it you can see that the email address where you want to send mail is already contained with an email address [email protected] and the email subject is already set to “Email To Us” text.

So how was that? Is it not really interesting? Now you can also add mailto link on your own website. When someone needs to contact you, he/she just click the link and the email sending box will be opened with an already contained email address and subject.

 

 

 

Leave a Reply

Your email address will not be published. Required fields are marked *