webmail-linker

Collection of Email Providers' Webmail Sites

webmail-linker.js

This is a JavaScript implementation of Webmail Linker. It can be used as a node.js module or in a browser.

Many websites require an email double opt-in during user registration. This project wants to fix the resulting break in user flow when users have to manually switch to their email providers' website to receive the confirmation email.

With Webmail Linker, you can offer a direct link to the user's webmail interface. In addition to the webmail URL, you'll get the name of the email provider and a favicon URL, so you can offer a button like "Check your email on [name and icon of the provider]".

npm install webmail-linker
var webmaillinker = require('webmail-linker'),
provider = webmaillinker.getProviderByEmailAddress('hello@googlemail.com');
 
if(provider) {
    console.log('Check your email at %s (%s)', provider.name, provider.url);
}
Check your email at Gmail (http://gmail.com/)

We recommend to use the awesome jsDelivr CDN to ship the latest version of webmail-linker.js to the browser:

<script src="//cdn.jsdelivr.net/webmail-linker.js/0.1/webmail-linker.min.js"></script>

You hate CDNs? You can also download webmail-linker.js from GitHub.

var provider = webmaillinker.getProviderByEmailAddress('hello@googlemail.com');
 
if(provider) {
    console.log('Check your email at %s (%s)', provider.name, provider.url);
}
require(['webmail-linker'], function(webmaillinker) {
    var provider = webmaillinker.getProviderByEmailAddress('hello@googlemail.com');
 
    if(provider) {
        console.log('Check your email at %s (%s)', provider.name, provider.url);
    }
});
console.log(webmaillinker.getProviders());
[
    {
        name: 'Hotmail',
        domains: 'hotmail[.][a-z.]{2,6}',
        url: 'http://hotmail.com/',
        icon: 'https://hotmail.com/favicon.ico'
    },
    {
        name: 'Outlook.com',
        domains: 'live[.][a-z.]{2,6} outlook[.][a-z.]{2,6} msn[.]com windowslive[.]com',
        url: 'http://outlook.com/',
        icon: 'https://hotmail.com/favicon.ico'
    },
    …
]
console.log(webmaillinker.getProviderByDomain('xs4all.nl'));
{
    "name": "XS4ALL Webmail",
    "domains": "xs4all[.]nl",
    "url": "https://webmail.xs4all.nl",
    "icon": "https://webmail.xs4all.nl/images/favicon.ico"
}
console.log(webmaillinker.getProviderByDomain('non.existent'));
null
console.log(webmaillinker.getProviderByDomain('info@edu.uni-graz.at'));
{
    "name": "Uni Graz",
    "domains": "edu[.]uni-graz[.]at",
    "url": "https://sbox.edu.uni-graz.at/",
    "icon": "https://it.uni-graz.at/favicon.ico"
}
console.log(webmaillinker.getProviderByDomain('hello@example.com'));
null
console.log(webmaillinker.getProviderByDomain('12345'));
Error: Invalid email address "12345" provided.
    at Object.WebmailLinkerGetProviderByEmailAddress [as getProviderByEmailAddress] (./node_modules/webmail-linker/lib/webmail-linker.js:40:10)