Module: drivers/gateways/smtp

This driver is used to send email by connecting to the SMTP server. The driver is using the following SMTP library :

Gateway parameters

The gateway parameters are defined in the gateway json (refer to core/gateways module). Those are passed directly to the nodemailer nodemailer.createTransport function (refer to

	"id" : 1,
	"name"  : "SMTP client",
	"description" : "...", 
	"activ" : 1,
	"driver": "smtp", 	// is linked to driver code (modbus.js) implementing the driver functions.
	"json"  : { 		// used to store driver parameters.
		"smtp : {
			host: '',
			port: 465,
			auth: {
				user: '',
				pass: 'userpass'
		"defaultSubject" : 'home automation', 		
			// Defines a default subject for mails if missing.
		"defaultFrom" 	 : '', 	
			// SMTP allows multiple FROM addresses in the RFC.
			// if only one address is used and the auth user is the email address,
			// then it can be left empty.											 
		"froms" : ['', ''] 
			// froms is the list of addresses that may send emails. 
			// If only one address is used it can be left empty
	"private_json" : {...} 		//can be used by anyone to store custom informations independent from the driver itself.

Address format

The address name is the standard the email address with optional additional "from" and "subject". The information between brackets is optional: [from]:to:[subject]. It is possible to have multiple destinations by seperating the emails addresses with comma. The body of the sent email is the value written on the address. Here are some valid examples for the address
  • would be used to send an email to with default subject.
  • would be used to send an email to with as sender.
  •, would be used to send an email to and with as sender.
  •, is the same as above, but defines also a custom subject (windAlert).

Use cases

The use of the SMTP driver is only to send emails from the system. In order to receive emails, another driver should be integrated (e.g. imap / pop3 client). Note that if the email address does not exist yet in the system, it will be added automatically.

//sends basic email with the default subject.
gateways.writeValue('', 'this is the email body')

//sends email to multiple destination with custom email subject.
gateways.writeValue(',', 'The wind speed was recorded above 60 m/s at 17:16 the 7 of July')