jquery - Javascript - Check if email configured - Stack Overflow

We can send a mail using mailto: in HTML and JavaScript. Is there any possible method to check if the e

We can send a mail using mailto: in HTML and JavaScript. Is there any possible method to check if the email is configured (i.e. whether any default email service to send email - such as Outlook - is available)?

I need to handle this

if(emailConfigured == true)

{
    // send mail

} else {

    // give alert
}

We can send a mail using mailto: in HTML and JavaScript. Is there any possible method to check if the email is configured (i.e. whether any default email service to send email - such as Outlook - is available)?

I need to handle this

if(emailConfigured == true)

{
    // send mail

} else {

    // give alert
}
Share Improve this question edited May 20, 2018 at 12:19 Stephen Kennedy 21.6k24 gold badges97 silver badges113 bronze badges asked May 7, 2012 at 14:12 iOSiOS 3,6263 gold badges44 silver badges86 bronze badges 3
  • 1 What do you mean by e-mail configured? – Koen Peters Commented May 7, 2012 at 14:12
  • Btw, if(emailConfigured) is sufficient – Amberlamps Commented May 7, 2012 at 14:13
  • To check whether any default email service to send email, like Outlook is available. – iOS Commented May 7, 2012 at 14:15
Add a ment  | 

3 Answers 3

Reset to default 7

No, you can't do this. It is pletely impossible. The JavaScript environment has no access to the host puter to tell if something is configured to handle mailto: links. That is so far outside the bounds of your webapp's responsibility that you should not and can not worry about it. It's not your page's job to figure out if the user knows how to send emails.

Would it not be possible to use javascript to open new email window and check afterwards if the window changed?

   window.location.assign("mailto:[email protected]?Subject=ABC);

If it the window did not change, you can conclude that the email is not properly configured.

you can add following html if email configured by php or ... and do :

<!-- html -->
<input type="hidden" value="[email protected]" id="mailto" />


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

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

} else {

    // give alert
}

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745137441a4613270.html

相关推荐

  • jquery - Javascript - Check if email configured - Stack Overflow

    We can send a mail using mailto: in HTML and JavaScript. Is there any possible method to check if the e

    1小时前
    20

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信