waughj/html-mail-link

Simple way to create HTML for email link.

v0.1.5 2019-06-04 20:48 UTC

This package is auto-updated.

Last update: 2024-05-05 07:29:23 UTC


README

Simple way to create HTML for email link.

Simply create an instance sending the email as the 1st argument and either use the object as a string or call getHTML() on it to automatically generate HTML for a mailto link.

Example:

new HTMLMailLink( 'waughjai@gmail.com' );

Generates the HTML:

<a href="mailto:waughjai@gmail.com'">waughjai@gmail.com</a>

For custom value shown in the link, push a hash map as the optional 2nd argument with the value you want in the "value" key:

Example:

new HTMLMailLink( 'waughjai@gmail.com', [ "value" => "Email me." ] );

Generates the HTML:

<a href="mailto:waughjai@gmail.com'">Email me.</a>

This hash map can also be used to send all other valid HTML5 attributes, as well as other options. See HTMLLink source code at https://github.com/waughjai/html-link for mo' details.