To allow visitors to your website to contact you, you don't necessarily need a complicated form. You can create a link with a single line of code that will send the most important information. When the link is clicked, the visitor's default email program will open and they can easily send you a message. You can even predefine parts of the content and subject line, as well as multiple recipients with just one line of code. How this works, you will learn in this article.
This link is a very simple link with no defaults. The code looks like this:
<a href="mailto:john.doe@domain.de">Write email</a>
With this code line you can directly specify who else should receive this email:
<a href="mailto:john.doe@domain.de, jane.doe@domain.de">Write email to two people</a>
This default is especially handy because you can easily recognize and filter e-mails based on the subject. So you know, for example, whether an email is important or urgent.
<a href="mailto:john.doe@domain.de?subject=Hier steht der Betreff">E-mail with subject</a>
This e-mail is sent by copy to another recipient. This address is visible to the one who composes the email.
<a href="mailto:john.doe@domain.de?cc=jane.doe@domain.de">E-mail with copy</a>
However, if you do not want the author of the e-mail to see who else the e-mail is being sent to, as in point 4, you can specify a so-called blind copy and have it sent.
<a href="mailto:john.doe@domain.de?bcc=jane.doe@domain.de">E-mail with blind copy</a>
You can also specify some content for the e-mails, but you have to keep in mind to specify the content in coded form.
An example might look like this:
<a href="mailto:john.doe@domain.de?body=Hallo John,
hier steht die Nachricht.">Write email</a>
Of course, you can not only specify the individual things as described in points 1-6. You can also combine everything and create a perfect email template with all the content you need from the author. Here you must note that all individual attributes must be connected with the abbreviation &, otherwise errors may occur or content may simply be missing.
<a href="mailto:john.doe@domain.de?subject=Hier steht der Betreff&body=Hallo John,
hier steht die Nachricht.">Write email with subject and prepared message</a>
As you can see, it is very easy to get as much information with just one link as with a form. You just have to create the link and insert it into your website at the desired place in the HTML code - done!
Sebastian Lochbronner
86830 Schwabmünchen
Germany