Skip to content
Creates a link to the webmail inbox based on email address.
JavaScript HTML
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
tests
.gitignore
CHANGELOG.md
LICENSE
README.md
link-to-inbox.js
link-to-inbox.min.js
package.json

README.md

link-to-inbox

Creates a link to the webmail inbox based on email address.

Install

npm install link-to-inbox

Usage

Get the HTML link tag

Without filters

var link = linkToInbox.createLink('test@gmail.com');
// '<a href="https://mail.google.com/mail/u/0/" target="_blank">Check your Gmail inbox</a>'

With filters

var link = linkToInbox.createLink('test@gmail.com', {subject: 'Confirm your account'});
// '<a href="https://mail.google.com/mail/u/0/#search/in%3Aanywhere+subject%3A%Confirm%252520your%252520account%22" target="_blank">Check your Gmail inbox</a>'

With custom link text

var link = linkToInbox.createLink('test@gmail.com', {subject: 'Confirm your account'}, 'Open in %s');
// '<a href="https://mail.google.com/mail/u/0/#search/in%3Aanywhere+subject%3A%Confirm%252520your%252520account%22" target="_blank">Open in Gmail</a>'

Just get the link

Without filters

var link = linkToInbox.getHref('test@gmail.com');
// 'https://mail.google.com/mail/u/0/'

With filters

var link = linkToInbox.getHref('test@gmail.com', {subject: 'Confirm your account'});
// 'https://mail.google.com/mail/u/0/#search/in%3Aanywhere+subject%3A%Confirm%252520your%252520account%22'

Credits

This JS module is based on the ideas in the following articles:

You can’t perform that action at this time.