Sending a Secure SMTP Email

Set Up the Email and SMTP Variables

The first step is to set the email and SMTP variables with values depending on your SMTP email account.

ZentriOS CommandsDescription
set email.name_address your@email.address set email.smtp.username your_user_name set email.smtp.password your_password set email.smtp.host your_smtp_host set email.smtp.port your_smtp_host_port Specify your email address Specify your user name. This may be same as your email address Specify your SMTP password Specify the SMTP host via which you send email Specify the SMTP host port. This is typically 587 for secure SMTP

For example, if your email is fred@gmail.com:

set email.name_address  fred@gmail.com
set email.smtp.username  fred@gmail.com
set email.smtp.password s3cr3tFredword
set email.smtp.host  smtp.gmail.com
set email.smtp.port 587

Set Maximum TLS version

This step is necessary only if the SMTP server requires it. You may need to set a maximum TLS version with the network.tls.version variable. For example:

set network.tls.version 10

Set the CA Certificate for your Device

You may require a TLS certificate for your device.

Obtain the Certificate

Obtain the certification in .pem format. For a discussion of certificates see the TLS Client app note.

Copy the Certificate to your Device

You can use the file_create command. For example:

file_create fred_ca_cert.pem 1569
-----BEGIN CERTIFICATE-----
d3RlLCBJbm...
...49cOSvkB5iy6
-----END_CERTIFICATE-----

Copy the certificate text from -----BEGIN CERTIFICATE----- to -----END_CERTIFICATE-----.

Alternatively you can use the Zentri Web App Files tab to drag and drop the certificate file.

SeeZentriOS Web App, Files Tab.

Set the Network TLS CA Cert

Set the value of the the network.tls.ca_cert to the CA certificate file you have created. For example:

set network.tls.ca_cert fred_ca_cert.pem

Configure Gmail to Support Sending Emails from ZentriOS

In the case of the Google SMTP servers, you need to switch the Google mail Access for less secure apps setting on.

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

Send the Email

To send the email using the command API, use the smtp_send command:

smtp_send <to email address> <email subject> <length of email content>

Supporting ZentriOS Editions and Versions

Change Log

ModifiedChanges
2016-02-09Created