Skip to main content

E-mail notifications

Instructions for sending e-mail messages from the application

Description​

E-mail messages are sent using a driver based on AV & Customs Systems. The driver works with your mail server account. You can use it to receive notifications when relays, smoke detectors, motion sensors, or other devices are triggered, and to send e-mail without leaving i3 Pro. This example uses the Gmail mail server, but you can adapt it to send e-mail through another SMTP server. To do this, change the following: SMTP server: smtp.gmail.com, port: 465, account login: your_login@gmail.com, application password: password, and the SMTP server authorization response (see the project example).

Tip

Example: E-mail

  1. To send messages through a Gmail account, you need to grant access to the account. There are two ways to do this:

1.1. Allow the application to send messages through your Gmail account. To do this, you need to grant less secure apps access to the account:

https://www.google.com/settings/security/lesssecureapps

or send the first e-mail: you will receive a message about a less secure app. Allow access for less secure apps.

Email2.png

1.2. Enable two-step authentication in the mail security settings and create an application password

Mail2FA.jpg

AppPass.jpg

  1. Download the example above.

  2. Open the "Gmail_SMTP_sample" script and enter the required data:

Email1.PNG

  • name_from - e-mail sender name;
  • email_from - the e-mail address of your Gmail account;
  • password - your mail account password / the application password configured in Gmail;
  • email_to - the recipient's e-mail address;
  • header - message subject;
  • message - message text.

Example:


function try_to_send ()
{
send_email("From Smart Home", "******@gmail.com", "12345", "destinationaddress@anydomain.com", "Header of message", "Text of message")
}

Note

The "message" field accepts only message text (without attached documents or images).

  1. Bind the "Send email" command to an event.

Email3.png

  1. To send an e-mail, trigger the event (for example, by calling a function when a button is pressed).
In this article: