In order to send emails, you:
Connect the controller
to Ethernet via one of the ports on the HMI panel or on a COM module,
or
to a GPRS modem ( connected to the controller's RS232 port or USB port)
To send email, you must assign a DNS Server. |
Configure an email accountConfigure an email account
On the Solution Explorer, select Emails>Accounts.
Name the account.
Set the account properties.
Note the Password/App Password field. You can use this to supply an App Password, such as is required by Gmail.
Note that users can also configure email Accounts via UniApps.
On the Solution Explorer, select Emails Emails and click Add New Mail.
Use the Properties Window to:
- assign the Mail account; this account sends the email.
- select a String ASCII tag to supply the To Address, as well Cc and Bcc if desired
- attach data
Note that you can also enable users to add recipients via the HMI widget Mail Configurator.
Click on Elements to add them to the body of the email, and edit them via the Properties Window.
Add attachmentsAdd attachments
Click Attachments and select the appropriate type.
Send the email via LadderSend the email via Ladder
Use the Send Mail Ladder function as shown
below.
Note that when you create a mail, a supporting data tag struct is automatically created. Use the members of the struct to monitor the email status.
Email Struct
Name |
Data Type |
Definition |
|
Success |
Bit |
ON=Sent Successfully |
|
Failed |
Bit |
ON=Send Failed |
|
Initialization Status |
UINT32 |
Code |
Message |
0 |
No Errors |
||
1 |
Function Started |
||
2 |
Function in Progress |
||
-1 |
General COM Error. Please check the physical connections. |
||
-2 |
TimeOut error |
||
-3 |
DNS error |
||
-4 |
Attach File error |
||
-5 |
Access denied |
||
-6 |
Parse Data error |
||
-7 |
Recipient email address error |
||
-8 |
Packet size exceeded |
||
-9 |
Attachment Error: No file exists/was found in the email's Configuration |
||
|
|
-10 |
unable to get local issuer certificate' when sending an email |
If you have more than one Account defined in your project, users can select an account and edit the From, Username, and Password parameters, as well as Server settings.
To enable UniStream to access Gmail, your Google account must have activated:
2-Step Verification
App Passwords; an App password must then be entered into the UnLogic email account settings.
In your Google Account Settings, turn on 2-Step Verification as follows:
Enter your Google Account.
Click your user icon, select Manage from the drop-down menu, and
click Manage your Google account.
Select Security
Turn on 2-step verification.
Click Get Started.
Enter your password and click Next.
Google will send a verification code
to your bell phone. Enter the code and click Next.
When 2-Step Verification is activated in your account, you can activate and get an App Password.
Enter your Google Account.
Click your user icon, select Manage from the drop-down menu, and
click Manage your Google account.
Select Security, scroll down tp App passwords
and click it.
Click Select app, and select Other.
Enter UniLogic, and click Generate.
Google will reveal the App Password.
Record it, copy to Clipboard,
and click Done
This is the password that you enter into UniLogic, and that will
be downloaded into the PLC, enabling Google to identify the PLC.
![]() |
Ensure that you record this password, Google will not show it again. You can generate another password, but remember that you must then edit the controller's email settings. |
Paste/enter the app password into your UniLogic
project and download it to the controller; now Google will be able
to verify the controller, and emails may be sent and received via
gmail according to your UniLogic program.
If you are connected to the Internet, you can access this UniLogic tutorial: