0.5.8 • Published 3 years ago
mxmail v0.5.8
Mxmail
Send mail directly to mail exchange servers or SMTP. Based on nodemailer.
Installation
npm i mxmailUsage
const mxmail = require('mxmail')
// If config is defined, mx lookup is skipped
const config = {
  host: 'smtp.ethereal.email',
  port: 587,
  auth: {
    user: 'virginia.cassin10@ethereal.email',
    pass: '1md9Xes49Nbfka6aFw'
  }
}
const mailer = mxmail(config)
// Set up mail
const mail = {
  from: '"Fred Foo 👻" <foo@example.com>',
  to: 'bar@example.com, baz@example.com',
  subject: 'Hello ✔',
  text: 'Are you ready?',
  html: '<b>Are you ready?</b>'
}
// Will lookup mx records automatically for each email in 'to'
const result = await mailer(mail)If you need a valid message ID, there is a generator function included:
// Using the hostname of your computer
const id = mxmail.id()
// Using the domain you pass
const id = mxmail.id('example.com')
// Will return similar to:
// <223d0b02-e987-2647-e30c-b71070a587ce@example.com>Command line
Install the command line interface with:
npm i -g mxmailAdd a settings file in ~/.mxmail.json:
{
  "from": "vidar@example.com",
  "config": {
    "host": "smtp.ethereal.email",
    "port": 587,
    "auth": {
      "user": "virginia.cassin10@ethereal.email",
      "pass": "1md9Xes49Nbfka6aFw"
    }
  },
  "aliases": {
    "@sp": "suong@example.com"
  }
}Send email like this from the command line (terminal):
mx suong@example.com subject "This is the message"Replace with aliases like this:
mx @sp subject "This is the message"Send file attachments like this:
mx @ve "File" "Check this" ~/file.jpgUsing zsh alias:
alias file='mx @ve "" ""'
file ~/file.jpgMIT Licensed. Enjoy!
0.5.8
3 years ago
0.5.7
4 years ago
0.5.6
4 years ago
0.5.4
4 years ago
0.5.3
4 years ago
0.5.5
4 years ago
0.3.0
4 years ago
0.2.1
5 years ago
0.2.0
5 years ago
0.5.0
4 years ago
0.3.2
4 years ago
0.4.0
4 years ago
0.3.1
4 years ago
0.2.2
4 years ago
0.1.3
5 years ago
0.5.2
4 years ago
0.3.4
4 years ago
0.5.1
4 years ago
0.3.3
4 years ago
0.1.2
5 years ago
0.1.1
5 years ago
0.1.0
5 years ago