Button html for email
To create a button in HTML that links to an email address, you can use the <a>
tag with the mailto
protocol. Here is an example:
<a href="mailto:[email protected]">Send Email</a>
This will create a button that says "Send Email" and when clicked, will open the user's default email client with the email address [email protected]
pre-filled in the "To" field.
You can customize the button by adding additional attributes to the <a>
tag. For example, you can add a class to style the button:
<a href="mailto:[email protected]" class="email-button">Send Email</a>
Or you can add a title attribute to provide additional information about the button:
<a href="mailto:[email protected]" title="Send an email to [email protected]">Send Email</a>
You can also add other attributes such as target
to specify where the email client should open the email:
<a href="mailto:[email protected]" target="_blank">Send Email</a>
This will open the email client in a new tab.
Here is the full list of attributes you can use with the mailto
protocol:
mailto
: The email address to send the email to.subject
: The subject line of the email.body
: The body of the email.cc
: The email address to CC the email to.bcc
: The email address to BCC the email to.target
: The target window or frame to open the email client in.
Here is an example of using some of these attributes:
<a href="mailto:[email protected]?subject=Hello&body=Hello%20World&[email protected]&[email protected]" target="_blank">Send Email</a>
This will open the email client with the subject line "Hello", the body "Hello World", and CC and BCC the email to [email protected]
and [email protected]
respectively.