2

I am creating two contact button for two persons in HTML and CSS. My aim is while clicking on the button user will directly send them mail using outlook platform. My code for person1 is given below:

<p><form action="mailto:[email protected]" method="post" enctype="text/plain"><button class="button1" a href="mailto:[email protected]">Contact</button></p> 

It creates a contact button and while clicking on that button it shows mail id in outlook is [email protected] is perfect.

Now code for person2 is given below:

<p><form action="mailto:[email protected]" method="post" enctype="text/plain"><button class="button1" a href="mailto:mailto:[email protected]">Contact</button></p> 

But here while clicking on the Contact button instead of showing "[email protected]" id it shows id for person1 which is [email protected].

I am unable to resolve this issue.

2 Answers 2

2

I think part of the problem might come from the fact that you have two apparent mistakes in your code.

First of all, you're not closing your <form> tags.

Secondly, your second link's "href" is set to : "mailto:mailto:[email protected]" instead of "mailto:[email protected]"

Making these changes fixed it for me!

Sign up to request clarification or add additional context in comments.

1 Comment

You're welcome man, glad to help. Keep in mind, for this specific use, the buttons dont need to have a "href" attribute. Moreover, I think it would be best to use regular <a> tags with an href attribute, and styling it to look like a button with css. That is, if you don't need the <form> tags for something else you haven't included in your post.
2

Just add closing tags for the form, and correct this line - a href="mailto:[email protected]".

<form action="mailto:[email protected]" method="post" enctype="text/plain">
  <button class="button1" a href="mailto:[email protected]">Contact</button>
</form>

<form action="mailto:[email protected]" method="post" enctype="text/plain">
  <button class="button1" a href="mailto:[email protected]">Contact</button>
</form>

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.