User Tools

Site Tools




The SIB SMTP Caller is a specific caller used to send emails from messages on SIB MQTT topics.




  • Subscribe: .custom.topic
    • on message:
      • custom.inputFormat
        • Substitute missing message parts from the .custom.default configuration
        • Send email
        • Add status information to message
        • Publish resulting message on responseTopic

Custom configuration

var SMTPCallerCustom = {
	_id: "SMTPSample:1",
	_name: "SMTPCallerSample",
	default: {
		to: "",
		from: "",
		subject: "Some default subject here",
		text: "Some random text for non HTML enabled clients",
		html: "<b>HTML</b> formatted default mail body"
	init: ( thisCaller )=>{},
	inputFormat: (topic, msg, cb)=>{
	loggerCfg: {
		dest: {
			file: false,
			console: true,
			mqtt: true
	outputFormat: (topic, msg, cb)=>{
	smtp: {
		host: "",
		port: 465,
		secure: true,
		auth: {
			user: "authenticated_user",
			pass: "thePassword!"
		tls: {
			rejectUnauthorized: false
	mqtt: "mqtt://localhost",
	topic: "SIB/test/SMTPCaller"
module.exports = SMTPCallerCustom;
  • _id: The unique ID of this service
  • _name: A plaintext description of this service
  • default: The default message if parameters are left out on the MQTT topic
    • to: The default recipient of the message
    • from: The default sender of the message
    • subject: The default subject of the message
    • text: The default plaintext content of the email message
    • html: The default HTML formatted mail body
  • init(thisCaller): If defined this method is executed when the service is starting up as the last step of initialization. thisCaller is a reference to the instance of the caller that does the method call.
  • inputFormat(topic, msg, callback, mysqlConnection): The method that is run on service activation. The original message is passed as the argument and the input value to the callback must be a JSON formatted message conforming to the SIB message standard. If the message is null when returning from inputFormat no action is taken by the caller.
  • loggerCfg: A JSON Object defining what logger actions should be active for this service (see Logger Configuration
  • outputFormat(topic, msg, callback, mysqlConnection): This message is run on the response data before publishing to the response topic. The response message is passed as the argument and the input to the callback must be a JSON formatted message conforming to the SIB message standard.
  • smtp: The SMTP configuration, for more information see the nodemailer NPM package
    • host: The SMTP server
    • port: The port on the SMTP server on which to send messages
    • secure: Wether to use TLS or not
    • auth:
      • user: The user to log in as on the SMTP server
      • pass: The password to use for login
    • … all parameters that can be passed to the NodeMailer.createTransport function
  • mqtt: The MQTT connection string for the internal MQTT transport
  • topic: The MQTT topic to subscribe to on the internal MQTT transport
sib/callers/smtpcaller.txt · Last modified: 2019/09/20 07:27 by hubbe