EMAIL Component

Using the EMAIL component to invoke a REST API.

The EMAIL component allows you to send an email via API Express without using 3rd party services.

SMTP

Simple Mail Transfer Protocol (SMTP) is an Internet standard for electronic mail (email) transmission.
Although electronic mail servers and other mail transfer agents use SMTP to send and receive mail messages, user-level client mail applications typically use SMTP only for sending messages to a mail server for relaying. For retrieving messages, client applications usually use either IMAP or POP3.

SMTP connections secured by TLS, known as SMTPS, can be made using STARTTLS.

Email Properties

In the EMAIL SERVICE section, you can set:

  • Smtp Host
  • Port
  • Username
  • Password
  • Recipients
  • Subject
  • Mime type
  • Tls enabled.

In case of the successful sending of an email, the response of the EMAIL component is

{"status": "success"}

In case of failed invoking of an email, the response of the EMAIL component is

{
    "status": "failed",
    "failedDetailsMessage": "535-5.7.8 Username and Password not accepted. Learn more at\n535 5.7.8  https://support.google.com/mail/?p=BadCredentials v2sm6640082wmf.40 - gsmtp\n"
}

Samples

Let's consider one of the most popular email services Gmail for sending email messages.

The properties of the EMAIL component for Gmail are:
Smtp Host - 'smtp.gmail.com'
Port - '587'
Username - your Gmail account username (eg. '[email protected]')
Password - password of your Gmail account
Recipients - list of recipients (eg. '[email protected]')
Subject - your subject (eg. 'TestMessage')
Mime type - 'text/plain'
Tls enabled - should be enabled
REQUEST BODY - the value of the requestBody variable of JavaScript expression (in our example the value of requestBody will be "Hi, how are you?")

requestBody = "Hi, how are you?";
449

Play a little with the EMAIL component and test not only the positive but also the negative caseі (specify the incorrect password).