Skip to content

A simple service that generates a mailto: string that can be used in an <a href="">.

License

Notifications You must be signed in to change notification settings

updatezen/angular-mailto

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 

Repository files navigation

angular-mailto

A simple service that generates a mailto: string that can be used in an <a href="">.

Installation

Through bower:

bower install angular-mailto --save

Usage

Include angular-mailto.js in your application and add the module uz.mailto as a dependency to your app module

var myapp = angular.module('myapp', ['uz.mailto']);

The Mailto service

The Mailto service can be used to generate a mailto: string:

var recepient = "stefan@dontgohere.com";
var options = {
	cc: "cc.this.person@dontgohere.com",
	bcc: "bcc.this.person@dontgohere.com",
	subject: "Angular-mailto Email",
	body: "Hi Stefan,\nThis is an email pre-populated from angular-mailto."
};

var href = Mailto.url(recepient, options);

This will generate the appropriate mailto string:

mailto:stefan%40dontgohere.com?cc=cc.this.person%40dontgohere.com&bcc=bcc.this.person%40dontgohere.com&subject=Angular-mailto%20Email&body=Hi%20Stefan%2C%0AThis%20is%20an%20email%20pre-populated%20from%20angular-mailto.

you can then use this inside an <a> tag:

<a href="{{href}}">email me</a>
  • All options are optional.
  • For linebreaks / newlines in the email body, use the \n character.

License

Released under the terms of MIT License. See LICENSE.

About

A simple service that generates a mailto: string that can be used in an <a href="">.

Resources

License

Stars

Watchers

Forks

Packages