Abude
Abude

Reputation: 2162

is it possible to send email with javascript on a button?

Is there a way to make an email sent to the email address in the input when button is clicked? form like:

<form action="/" method="post" name="form" target="_blank">
    <h3><span>Subscribe to Newsletter</span></h3>
    <p class="email_first">
        <label for="email">Your Email</label>
        <input id="EMAIL" class="email" type="email" name="EMAIL" value="Your Email Address:" size="30" />
    </p>
    <p class="submit"><button type="submit">Send</button></p>
</form>

Thanks!

Upvotes: 1

Views: 1045

Answers (2)

hop
hop

Reputation: 2558

You can't send an email directly with java script.But, you can open the default mail client (say Outlook) from Java Script.

window.open('mailto:[email protected]');

Or you can ask your server to do the Job!

Upvotes: 0

Gyhth
Gyhth

Reputation: 1165

Javascript is client side, therefore you can't directly call any kind of email sending services. If you use Ajax and have it call on a PHP/JSP page, then it's possible, but with pure Javascript it isn't possible.

Upvotes: 1

Related Questions