To make a page where customers, clients or consumers can send you a message from the page itself, you would need to involve/include PHP.
If you just wish to make a button to open the users email client when they click it, whether it's Gmail on an Android, Outlook on a Windows PC or Mail on iOS, the following code will place your email address, or whichever email address you specify, into their 'To' or 'Recipients' section in their email client.
<a href="mailto:your@email.com">Click here to email me</a>
You are using just a standard <a></a>
tag but you are putting mailto:
, fiollowed by an email address, in the href
attribute. There are a few other you can use - you can see them, here.
You can add in other things to your mailto:
link:
- CC and BCC (carbon copy and blind carbon copy) -
<a href="mailto:your@email.com?cc=mother@email.com&bcc=father@email.com">Click here to email</a>
- Subject - tell the recipent a little bit about the email befroe they read it -
<a href="mailto:your@email.com?subject=This%20is%20just%20an%20email%20to%20say%20hi%20:)">Click here to email</a>
.
- Body - this is the mail part of the email -
<a href="mailto:your@email.com?body=Hello%20friend">Click here to email</a>
Please, ensure that for every space you wish to put in for the subject or body, put %20
instead. %20
is URL Encoding.