Khalil Ghâñmî

0 %
Khalil Ghâñmî
Front-end developer
  • Residence:
    Tunis
  • City:
    Bardo
  • Age:
    28
French
English
arabe
HTML 5 / CSS 3
JavaScript / jquery
PHP / MYSQL
WordPress
OpenCart 3
Vegas Pro
Adobe premier pro
  • Bootstrap, Materialize
  • Stylus, Sass, Less

The mailto command

24 août 2022

In HTML, the mailto: command allows you to request the Internet user’s email from a Web page. You can therefore place it on your site to allow your visitors to send you an e-mail.

Benefits

  • Very simple to install
  • Possibility to fill in by default certain fields such as the subject and the recipients in copy

The inconvenients

Generally poses a problem for Internet users using webmail: users of these services may have to type or copy your e-mail address to write to you.
Fairly limited message personalization.

How do I link to an email address?

Pour appeler une messagerie depuis une page Web, il suffit de créer un lien (comme d’habitude avec la balise <A HREF= »… »>) dans le code de la page puis d’utiliser l’instruction mailto:.

Ce qui donne par exemple, pour écrire à l’adresse Contact@khalilghanmi.com :

<a href="mailto:Contact@khalilghanmi.com">ici</a>

An example ? Click here !

If you wish to place several recipients, all you have to do is place the addresses one after the other, simply separated by commas (without spaces).

How to impose the subject of the message or the recipients of the copies?

It is possible with mailto: to fill in some default fields, such as the subject of the email or the recipients of the copies.

Imposing the subject of the email

Look: you will send an email to Contact@khalilghanmi.com with the subject “Hello”. Click here! So what code should I use? Here it is :

<a href="mailto:Contact@khalilghanmi.com?subject=Coucou">ici</a>

Warning: use the character string %20 instead of the space and %27 instead of the apostrophe.

Set copy recipients

You can even impose recipients of carbon copies (Cc:) and blind copies (Bcc:). Click here for an example! The code this time is:

<a href="mailto:Contact@khalilghanmi.com?subject=Coucou
&cc=ghanmi.khalil@gmail.com
&bcc=wordpress.khalil@gmail.com">ici</a>

Fill in the message

You can still fill in the first line of the email. Click here for an example. The code this time is:

<a href="mailto:Contact@khalilghanmi.com?subject=Coucou&body=La premiere ligne du message">ici</a>

Again, use the string %20 instead of the space and %27 instead of the apostrophe.

Protect your address on your own site

When you publish, through a mailto: link, your e-mail address on your website, you are likely to see it taken by address bots and to receive many unsolicited e-mails.

Posted in html, WebTags:
Write a comment