Skip to content

enraiser/keystone-enmailer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
 
 
 
 
 
 

Repository files navigation

enRaiser : keystone-enmailer

sending SMTP mail with Jade template

Installation

  1. create keystone project using yo keystone, and do not choose email feature.

  2. install keystone-enmailer

    npm install git+https://[email protected]/enraiser/keystone-enmailer.git

Usage

  1. In keystone.js at keystone.init add email template

    keystone.init({
         ... 
         'emails': 'templates/emails',
    });
  2. add globals in .env file

     SMTP_HOST=us2.smtp.mailhostbox.com'
     
     SMTP_PORT=587
    
     [email protected]
    
     SITE_EMAIL_PASSWD=*********
    
  3. create welcome.jade in templates/emails folder

    block body-contents
        h1 Hi #{first_name},
        p.text-larger We would like to verify your EmailID to enroll you on #{brand}.
        p.text-larger click 
            a(href='#{link}') 
                strong this link
            |    to complete this verification.
  4. now wherever you want to send mail add this code

    var enmailer('keystone-enmailer');
    
    var Email = new keystone.Email('welcome');
    var brand = keystone.get('brand');
    Email.send({
        mandrill: enmailer.mandrill,
        first_name: 'Sachin Sharma',
        link: "action/verify?user_id=" +newUser._id,
        subject: 'Please verify your email',
        to: "[email protected]",
        from: {
             name:brand,
             email: process.env.SITE_EMAIL_ADDRESS
         }
    });

About

SMTP email integration with keystoneJS

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published