@cidekar/browser-email-share

Create mailto links and send email using an email client.

Usage no npm install needed!

<script type="module">
  import cidekarBrowserEmailShare from 'https://cdn.skypack.dev/@cidekar/browser-email-share';
</script>

README

 

Introduction

Create "mailto" links and send email using an email client.

Documentation

Usage

    const EmailShare = require('@cidekar/browser-email-share')

    // New-up an instance
    const share = new EmailShare()

    // Render the DOM
    share.render(
        {
            body: 'Thank you for sending emails with our component.',
            subject: 'An email.'
        },
        document.getElementById('render')
    )

Define your DOM with data binding:

    const EmailShare = require('@cidekar/browser-email-share')

    // New-up an instance
    const share = new EmailShare({
        text: 'Email',
        slot: `<a
                    class="btn btn-blue"
                    href="mailto:?subject={{email.subject}}&body={{email.body}}"
                    target="{{anchor.target}}"
                    rel="{{anchor.rel}}">
                    {{anchor.text}}
                </a>`
    })

    // Render the DOM
    share.render(
        {
            body: 'Thank you for sending emails with your customized component.',
            subject: 'An email, created with a custom slot.'
        },
        document.getElementById('render')
    )

Generator

View our documentation by running the TypeDoc generator:

    $ yarn docs #TypeDoc 

Development

Package linking is a two-step process:

  • From the package folder create a symlink in the global folder.
    $ yarn link
    # success Registered "@cidekar/browser-email-share".
    # info You can now run `yarn link "@cidekar/browser-email-share"` in the projects where you want to use this package and it will be used instead.
  • Some other location, create a symbolic link from globally-installed package.
    $ yarn link @cidekar/browser-email-share

License

Copyright 2019 Cidekar, LLC. All rights reserved.

Apache License 2.0