Javascript - check if email is configured

We can send mail using mailto:html and javascript. Is there any possible way to check if the email is configured?

I need to process this

if(emailConfigured == true)

{
    // send mail

} else {

    // give alert
}

Please help me handle this. Thanks in advance.

+3
source share
2 answers

No, you cannot do this. It's impossible. In a JavaScript environment, there is no access to the host computer to tell if anything is configured to handle links mailto:. This is so far beyond your responsibility of Webapp that you should not and cannot worry about it. This is not your job on the page to find out if the user knows how to send emails.

+7

html, php ... do:

<!-- html -->
<input type="hidden" value="mymail@gmail.com" id="mailto" />


// Javascript
if($("#mailto")[0])

{
    // send mail
 window.location = "mailto:"+#("mailto").val();

} else {

    // give alert
}
-1

All Articles