开发者

Sending mail from javascript

I am developing a static website where in i want to send an email when H开发者_JS百科TML "Send Button" is clicked. IF it is possible it would be nice if u can share the code

Thanks


short answer: No!

Long answer: No, you can't send emails from static pages even using javascript. What you can do is to use ajax to send email from your html form.


It is possible ;-)

<input type="submit" value="Send" onclick="window.location ='mailto:email@address.com' "/>


In short: Forget it.

If you want to send email with the slightest resemblance of reliability, use a server side process. If you want to use JavaScript then you can use Ajax to pass the data to that server side process and/or SSJS.


It is not possible to send email from Javascript, you'll need to write a page in a language like PHP to receive the POST data and use the mail() command there.


I'm sorry but just with a static website you can't do it. One imaginable possibility would be make a very complex javascript code to access one webmail account you have, login there and send the email using this account to you. It's theoretically possible, but I've never seen something like it...

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜