ciql-mailer

mail templates with nodemailer

Usage no npm install needed!

<script type="module">
  import ciqlMailer from 'https://cdn.skypack.dev/ciql-mailer';
</script>

README

CIQL MAILER Logo

CIQL MAILER

CIQl Mailer is a tool which permits you to send mailer with many templates you can use for it.

Intallation

yarn add ciql-mailer

npm install ciql-mailer

ciql mailer all demo picture

Usage

const Mailer = require('ciql-mailer')
const agent = new Mailer()

agent.connect()

# agent.connect()

connect method permits you to initialize connection with mail.ciql.org credentials. If you want to use your own smtp configuration, use options parameter like this :

const Mailer = require('ciql-mailer')
const agent = new Mailer()

agent.connect({
  host: "xyz.test.com",
  port: 465,
  secure: true,
  auth: {
      user: "test@xyz.com",
      pass: "**********",
  },
})

# agent.setOptions(options)

Set options about the mail you want to send.

const Mailer = require('ciql-mailer')
const agent = new Mailer()

agent.connect()

agent.setoptions({ 
  subject: "Information about you", 
  from: "me@ciql.org", 
  to: "you@xyz.com",
  priority: "high", 
})

NB : connect() and setOptions() methods are required before sending email.

# agent.sendBlank(body)

Use this template to send email for blank.

const Mailer = require('ciql-mailer')
const agent = new Mailer()

agent.connect()

agent.setoptions({ 
  subject: "Information about you", 
  from: "me@ciql.org", 
  to: "you@xyz.com",
  priority: "high", 
})

agent.sendBlank("HI <b>You</b>, I'm very happy to see you today.")
.then(() => {
  //Do something
})
.catch((err) => {
  //Do something
})

# agent.sendCode(title:string, imgUrl:string)

sendPub ciql mailer Demo

Use this template to send email with code verification template. This function return the code which have been given.

const Mailer = require('ciql-mailer')
const agent = new Mailer()

agent.connect()

agent.setoptions({ 
  subject: "Information about you", 
  from: "me@ciql.org", 
  to: "you@xyz.com",
  priority: "high", 
})

agent.sendCode("Verification code", "Use this code to validate your account", 2536)
.then((code) => {
  //Do something
})
.catch((err) => {
  //Do something
})

# agent.sendApproval(title:string, description:string, noLink:string, yesLink:string)

sendPub ciql mailer Demo

Use this template to send approval email.

const Mailer = require('ciql-mailer')
const agent = new Mailer()

agent.connect()

agent.setoptions({ 
  subject: "Information about you", 
  from: "me@ciql.org", 
  to: "you@xyz.com",
  priority: "high", 
})

agent.sendApproval(
  "Production Approval", 
  "Do you accept condition to deploy now ?", 
  "https://api.approvals.com/no",  
  "https://api.approvals.com/yes"
  )
.then(() => {
  //Do something
})
.catch((err) => {
  //Do something
})

# agent.sendPub(imgUrl:string, title:string, description:string, openkLink:string)

sendPub ciql mailer Demo

Use this template to send Pub email with redirect link.

const Mailer = require('ciql-mailer')
const agent = new Mailer()

agent.connect()

agent.setoptions({ 
  subject: "Information about you", 
  from: "me@ciql.org", 
  to: "you@xyz.com",
  priority: "high", 
})

agent.sendAds(
  "https://images.com/eiug254ef", 
  "New product", 
  "For developers and managers, it is very important", 
  "https://products.com/seemore")
.then(() => {
  //Do something
})
.catch((err) => {
  //Do something
})

# agent.sendArticle(title:string, description:string, imgUrl:string, paragraphs:Array)

sendPub ciql mailer Demo

Use this template to send Article email with one or many paragraphs.

const Mailer = require('ciql-mailer')
const agent = new Mailer()

agent.connect()

agent.setoptions({ 
  subject: "Information about you", 
  from: "me@ciql.org", 
  to: "you@xyz.com",
  priority: "high", 
})

agent.sendArticle(
  "New product", 
  "For developers and managers, it is very important", 
  "https://images.com/eiug254ef", 
  [
      {
      title : "",
      img : "",
      text:""
    },
    {
      title : "",
      text:""
    }
  ]
  )
.then(() => {
  //Do something
})
.catch((err) => {
  //Do something
})

Paragraphs parameter contains one or many paragraphs in Array. Each paragraph is an object with image, title and text attributes.

Licence

MIT License

Copyright (c) 2021 dykoffi

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

LICENSE MIT