Node.js Sendmail Program
Free to Download
Foreword: Written with ECMAScript in Node.js .
By: Chrysanthus Date Published: 16 Jul 2016
const ms = require('./Mailsend');
This includes the mailsend module (assuming it is in the same directory as your program).
This variable must be coded with its email address. This is the address to which an email will be sent to, by the email server if an error occurs in the transmission. It can be the same as one of the addresses in the From field.
This array must be coded with at least one of the recipients address.
ms.setFrom("'Bob Example' <email@example.com>");
This variable must be coded with one or more email addresses, separated by commas, in a string. In this heading you have just one email address. It is for the person (or people) who wrote the email.
The use of this variable is optional. A copy of the email can be sent to the address (or addresses).
The use of this Blind Carbon Copy variable is optional.
The use of this variable for the subject is obligatory.
ms.setBody("something sometning sometning");
The use of this variable, for the body of the letter is obligatory. The string value can be very long.
This function should be typed after the above has been typed. It sends the email to the email server (MSA, Mail Submission Agent), which sends the email to the destination. You can use the function as follows:
console.log(feedback + ' Message has been sent.');
The argument to the sendmail() function is a callback function, with two parameters: err and feedback. If an error occurs, err has the error message, otherwise it is undefined. If the mail is sent to the MSA, then the value of feedback is Boolean true.
Installation is easy. Just download the free Mail Send program from the following link:
It comes as a zipped directory. Unzip the directory and you will find the file (module), Mailsend.js . Copy this file into the same directory as your ECMAScript program that has the above code.
Mailsend.js is a text file. Open the file with your text editor. Change the port and the domain name of your mail server from,
const port = 587;
const remoteHost = "localhost";
to something like,
const port = 25;
const remoteHost = "mail.o2online.de";
Save the file. Thatís all.
Any problem or suggestion or comments you have about the program should be done at the following group. You may need to subscribe (freely) first.
Related LinksECMAScript Basics
Expressions in ECMAScript
Statements in ECMAScript
Custom Objects in ECMAScript
Functions in ECMAScript
ECMAScript Date Object
The ECMAScript String Object
ECMAScript String Regular Expressions
ECMAScript Template Literal
The ECMAScript Array
ECMAScript Sets and Maps
Scopes in ECMAScript
Sending Email with ECMAScript
ECMAScript Insecurities and Prevention
Advanced ECMAScript Regular Expressions
Promise in ECMAScript 2015
Generator in ECMAScript 2015
More Related Links
Node.js Web Development Course
Major in Website Design
Low Level Programming - Writing ECMAScript Module