Is it possible to implement mailto:
function on submit button like <input type="submit" />
? I use ASP.NET MVC. Maybe there is some tricky controller action result to achieve this. Could you please help me?
P.S. I know that I can make anchor looks like a button.
If you're not using a rich text module or a CTA, you can create a mailto link manually instead. Highlight the text you want to link, then click the Link to dropdown menu and select URL. In the Link URL field, enter mailto:[email protected], then replace [email protected] with the recipient's email address.
You might use Form tag with action attribute to submit the mailto . Show activity on this post. But if you are doing it from a button you may want to look into a javascript solution.
Mailto link is a default way to sending a mail when the consumer wants to communicate or wants to give feedback, then clicking the mailto link will open a default sending mail window. So we can use mailto which directs us to the mail once the form is submitted.
To link a submit button to another webpage using HTML Form Tags: Using the HTML Form's Action Attribute, we can link the submit button to a separate page in the HTML Form element. Here, declare/write the “Submit button” within HTML Form Tags and give the File Path inside the HTML form's action property.
In HTML you can specify a mailto:
address in the <form>
element's [action]
attribute.
<form action="mailto:[email protected]" method="GET"> <input name="subject" type="text" /> <textarea name="body"></textarea> <input type="submit" value="Send" /> </form>
What this will do is allow the user's email client to create an email prepopulated with the fields in the <form>
.
What this will not do is send an email.
This seems to work fine:
<button onclick="location.href='mailto:[email protected]';">send mail</button>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With