Mail SMTP sender object

# new TubMailSenderBind (paramsObj:  object)

Arguments:
  • paramsObj: object
    • host:  string

      mail server host

    • port:  string

      mail server port

    • user='':  string

      mail server login

    • password='':  string

      mail server password

    • OAuth2Token='':  string

      for XOAUTH2 authentication set this token to value, obtained using openid-connect. See ubqMailJob.js for example

    • tls:  boolean

      use tls on server request. OpenSSL libraries version >= 0.9.7 must be installed - see package README.md for details

    • fullSSL:  boolean

      Setup TLS before any command to SMTP

    • auth:  boolean

      authentication required

    • deferLogin:  boolean

      do not call an SMTP Login method inside a constructor (MUST be called manually)

    parameters object

Methods

# login () static

Login to mail server (if deferLogin === true in a constructor) throws on any error

# sendMail (mailObj:  object) → boolean static

send an email message

Return:

True if successfully

Arguments:
  • mailObj: object
    • subject:  string

      mail subject

    • bodyType=UBMail.TubSendMailBodyType.Text:  UBMail.TubSendMailBodyType

      mail body type

    • body='':  string

      mail body. If bodyType is Calendar then valid *.ics file

    • fromAddr='':  string

      sender address

    • replyTo='':  string

      the Reply-To address in email

    • toAddr=[]:  Array.<string>

      array of receivers addresses

    • ccAddr=[]:  Array.<string>

      array of carbon copy (CC) addresses

    • attaches=[]:  Array.<UBMail.TubMailAttach>

      array of attaches. Ignored when bodyType is Calendar.

    sending mail object