Skip to content

TeamKART/send-html-mail

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

send-html-mail

Node.js script for sending HTML or Text emails from the command line

Requirements

Example

Body of an html email is stored in path/email.html to be sent to [email protected] and [email protected] with subject Hello world

Username: [email protected]

Password: 123456

Open a new shell (PowerShell if windows), go to the folder where the repo was cloned to and execute any of the following

node send --user [email protected] --pass 123456 --to [email protected] [email protected] --subject "TEST mail" --body "path/email.html"

node send -u [email protected] -p 123456 -t [email protected] [email protected] -s "TEST mail" -b "path/email.html"

node send -u [email protected] -p 123456 -t [email protected] -t [email protected] -s "TEST mail" -b "path/email.html"

Options

  • Username: --user or -u

    Username. Required. Must be a valid email ID. If variable is absent, environment variable MGUSERNAME is used

  • Password: --pass or -p

    Password. Required. If variable is absent, environment variable MGPASSWORD is used

  • Service: --service

    Default value is "Mailgun". List of supported services are here

  • Proxy Server: --proxy

    If variable is absent, environment variable HTTP_PROXY is used. The proxy server must support SMTP transport

  • To: --to -t

    Recipients. At least one is required

  • Cc: --cc -c

  • Bcc: --bcc

  • Subject: --subject -s

  • ReplyTo: --replyTo -r

    ReplyTo address. If present, must be a valid Email ID

  • From: --from -f

    Must be a valid email ID. Default value is the Username

  • Name: --name -n

    Sender's displayed name

  • Body: --body -b

    Body of the mail. Must be a valid file path.

  • Headers: --headers -h

    Additional mail headers. The string must be JSON. For example:

    --headers "{`"X-Mailgun-Campaign-Id`":`"foobar`"}"
    
  • List: --list -l

    List headers. The string must be JSON. For example:

    --list "{`"unsubscribe`":`"%unsubscribe_email%`"}"
    
  • Text Mode: --text

    If variable is present, mail will be sent as text message and not HTML

  • Debug Mode: --debug

    Turn on debugger mode

Within IIT KGP

KGP's proxy server will not work with this because it doesn't support some necessary features for SMTP transport

About

Send Emails from the command line

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published