如何在Javascript中打开电子邮件 [英] how to open email in Javascript

查看:162
本文介绍了如何在Javascript中打开电子邮件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好,我希望在验证后发送电子邮件中的表单详细信息,但我不知道如何将警报发送到哪里我想要发送详细信息继承我的代码示例

hi i'm looking to send details of form in email after validation but i don't know how i put an alert in where i would like to send the details heres a sample of my code

if(compName)
{
    document.getElementById('country').focus();
    compName=true;
    if(compContry)
    {
        document.getElementById('Phone').focus();
        compContry=true;
        if(compphone)
        {
            document.getElementById('email').focus();
            compphone=true;
            if(compemail)
            {

                    //this is where i want to send details of form in email 
                    alert("Your Details Are Sent ");
                    compemail=true;
                }
                else
                {
                    document.getElementById('email').focus();
                    compemail=false;
                }
            }
            else
            {
                document.getElementById('Phone').focus();
                compphone=false;
            }


    }
    else
    {
        document.getElementById('country').focus();
        compContry=false;
    }
}
else
{
    document.getElementById('username').focus();
    compName=false;
}

}

}

推荐答案

您无法使用javascript发送电子邮件,您可以获得的最接近的邮件地址是 mailto ,这会打开默认的电子邮件客户端 - 但它不会发送任何东西。

You can't send an email with javascript, the closest you can get would be a mailto which opens the default email client - but that won't send anything.

电子邮件应该从服务器发送 - 以正常方式提交表单,然后在服务器上构建电子邮件并发送。你如何做到这一点取决于你在服务器上运行的内容。

Email should be sent from the server - submit the form in the normal way, and construct the email on the server and send it. How you do this depends on what you are running on the server.

这篇关于如何在Javascript中打开电子邮件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆