Sending Email from an Omron CJ2H-CPU64-EIP via the CJ1W-ETN21 Ethernet Module
The CJ2H-CPU64-EIP is a high-performance CPU in the Omron CJ2 platform with a built-in EtherNet/IP port, 50 kSteps program capacity, and 32 Kwords of data memory. The EIP suffix designates the integrated Ethernet interface, but that port is limited to EtherNet/IP and FINS/TCP communications, peer-to-peer messaging, and socket service. It does not include an SMTP/POP3 mail client. To dispatch email directly from the controller you must add a dedicated Ethernet unit — the CJ1W-ETN21 — to the CJ2H backplane and use its built-in mail send function.
This article walks through the hardware selection, CX-Programmer configuration, ladder logic, NS-series HMI integration, and the audit-trail workflow required to alert management when a parameter such as a press force tolerance is changed by an operator holding an RFID badge.
1. Why the CJ2H-CPU64-EIP Cannot Send Email by Default
The on-board Ethernet port on the CJ2H-CPU64-EIP is implemented as an EtherNet/IP scanner/adapter with FINS/TCP wrapper. The Omron datasheet for the CJ2H-CPU6@-EIP series documents FINS network communications instructions, host link service, and remote programming, but no SMTP or POP3 client. Email send is a function exclusive to the CJ1W-ETN21 (and the older CJ1W-ETN11), which carries its own TCP/IP stack and an embedded mail engine that can resolve a DNS name, perform an AUTH LOGIN handshake, and push MIME-formatted messages to an SMTP relay.
If a SCADA package (Citect, Wonderware, WinCC, CX-Supervisor) is already present on the same Ethernet segment, the SCADA can take the role of mail client and the PLC only needs to push an event flag. In a no-SCADA architecture — the situation described in the source — the ETN21 is the cleanest path.
2. Hardware Prerequisites
| Item | Part / Catalog | Notes |
|---|---|---|
| CPU | CJ2H-CPU64-EIP | 50 kSteps, 32 KW DM, built-in EtherNet/IP port |
| Ethernet unit | CJ1W-ETN21 | 100Base-TX, SMTP/POP3/FTP/SNMP, FINS/TCP |
| Power supply | CJ1W-PA205R (or PA202) | 5 V/24 V backplane, 5 A/0.8 A |
| CPU rack | CJ2H-CPU6@-EIP mounted on CJ1W-BC[][] | 3, 5, 8, or 10 slot |
| Expansion rack | CJ1W-BC[][] + I/O | Optional, for digital inputs (RFID reader) |
| HMI | NS10-TV01 (or NS8-TV0[]) and NS8-TV01 | Ethernet-connected via ETN21 or built-in port |
| RFID reader | Omron V680 or third-party Wiegand reader | Badge ID stored in DM area |
| Programming software | CX-Programmer 9.x (FA Integrated Tool Package) | IEC 61131-3 + ladder |
| Ethernet cable | Cat 5e, RJ-45 | Patch panel to managed switch |
The CJ1W-ETN21 is mounted in any I/O slot of the CPU rack. The CPU is unit 0; the ETN21 is typically unit 1 or 2. A CJ-series I/O allocation rule reserves the last 10 words of the rack for special I/O, so keep ETN21 in slots that do not collide with expansion chassis mapping.
3. CJ1W-ETN21 Email Engine Architecture
The CJ1W-ETN21 maintains an internal mail send queue. The PLC writes a structured message into a designated data area (D area) and issues a single FINS command (code 28 10 — MAIL_SEND) to the unit. The unit's firmware resolves the SMTP server, opens TCP/25 (or 465/587 for TLS-style submission if the destination supports it), transmits the headers and body, and stores a status word the PLC can poll.
The mail body is held as raw ASCII in consecutive DM words. With the default 16-bit word packing, the ASCII string "Press tolerance changed by OP42" occupies 17 words (34 bytes) plus a leading length word. Allocate generously — 500 words gives room for tags, timestamp, badge ID, and old/new value pairs.
4. CX-Programmer Configuration Steps
4.1 I/O Table Setup
- Open the project in CX-Programmer. Double-click the I/O Table node in the project tree.
- Right-click the slot where the ETN21 is physically mounted and select Add Unit → Special I/O.
- Choose CJ1W-ETN21 from the catalog. Confirm the unit number (default 0).
- Transfer the I/O table to the PLC. The unit should self-test and light the RDY LED green.
4.2 ETN21 IP and Routing
- Open the ETN21 Setup dialog (double-click the unit).
- Set a static IPv4 address, subnet mask, and default gateway. Do not leave DHCP enabled in a plant — the mail engine must reach the SMTP relay deterministically.
- Define the SMTP Server IP, port, and authentication (USER/PASS as plain ASCII or Base64 — the unit encodes it).
- Set the local mail sender (e.g.
[email protected]) and a reply-to address. - Write the configuration to the unit using Toolbus → Transfer to Unit.
A record in the network architecture.
4.3 Memory Map for Mail
| Address | Purpose | Length |
|---|---|---|
| D00500 | Trigger word (1 = send mail) | 1 word |
| D00501 | Status word (0 = idle, 1 = sending, 2 = success, 8000 hex = error) | 1 word |
| D00502 | Error code (mail-specific) | 1 word |
| D00503 | Body length in bytes | 1 word |
| D00504 | Subject start (ASCII, 2 chars/word) | 20 words |
| D00524 | Body start (ASCII) | 500 words |
| D02000+ | Recipients buffer (To, Cc, Bcc) | 30 words |
The exact starting DM is user-defined — these values are a workable convention. The structure must match the ETN21 operating manual's "Mail Send Command Area" tables.
5. Ladder Logic: CMND Instruction to Trigger MAIL_SEND
The PLC uses the CMND instruction to issue the FINS mail-send command to the ETN21. The SEND/RECV ladder blocks handle data only; CMND(490) is the path for arbitrary FINS commands.
Control block (C in the example):
D00100 = command word 1 (always 0x0102 for SEND/RECV, 0x0000 for CMND)
D00101 = number of words in command area
D00102 = number of words in response area
D00103 = destination unit address (ETN21 unit number, e.g. 0x0001)
D00104 = FINS command code 0x2810 (MAIL_SEND)
D00105 = subcommand 0x0000
Example rung (structured text equivalent):
// Rising edge of "ParamChangeFlag" builds subject + body, then fires MAIL_SEND
IF ParamChangeFlag = TRUE AND MailBusy = FALSE THEN
Subject[0..39] := "PRESS TOL CHANGED "; // pad to even length
BodyLength := 0;
ASCII_APPEND(Body, "Operator: ", OpNameBuf);
ASCII_APPEND(Body, "\r\nOld value: ", OldTolSTR);
ASCII_APPEND(Body, "\r\nNew value: ", NewTolSTR);
ASCII_APPEND(Body, "\r\nTime: ", SysTimeSTR);
TriggerWord := 1;
MailBusy := TRUE;
END_IF;
IF TriggerWord = 1 THEN
CMND(#0280, C, 6, R, 0, MailStatus, &MailCmdOK);
END_IF;
IF MailStatus = 2 THEN
TriggerWord := 0; // clear trigger
MailBusy := FALSE;
END_IF;
In ladder, the same flow is built with MOV blocks to copy ASCII strings from the parameter-change buffer into the ETN21 body area, an ADBL/SDBL chain to compute the length, and a single CMND on the rising edge of the change flag.
6. NS10 / NS8 HMI Integration
The NS10-TV01 and NS8-TV01 panels are programmed in CX-Designer. The two HMIs read parameter values over Ethernet (FINS or EtherNet/IP) and display the live press tolerance. When an operator types a new tolerance into a numeric input field and presses Enter, the HMI writes the value back to a holding word in the PLC (e.g. D00300) and sets a confirmation bit W0.05.
To capture the who along with the what, the panel is also tied to the RFID reader. The recommended approach is to expose a "Login" numeric entry on the HMI that the operator fills by tapping the badge; the panel writes the badge ID to a dedicated DM block (D00400..D00409) and sets W0.00 = logged-in. A lookup table in the PLC maps badge ID to operator name for inclusion in the mail body.
The HMIs themselves do not need to send mail. They only need to present a confirmation dialog. The PLC owns the audit event.
| NS10/NS8 Element | Address | Function |
|---|---|---|
| Numeric Input — Tolerance | D00300 | Operator edits the value |
| Confirmation Lamp | W0.05 | Lit while PLC writes back |
| Login Numeric Display | D00400 | Current badge ID |
| Login Word Bit | W0.00 | Set = operator present |
| Operator Name | D00410..D00419 | ASCII, copied from lookup |
7. Capturing the Change Event
Detect the parameter change in the PLC with a one-shot on the change bit:
// One-shot on tolerance change
OldTol := D00300;
// ... operator presses Enter on NS panel ...
IF D00300 <> OldTol AND NewTolValid = TRUE THEN
ParamChangeFlag := TRUE;
OldTolSTR := REAL_TO_STRING(OldTol, "0.00");
NewTolSTR := REAL_TO_STRING(D00300, "0.00");
OpNameBuf := LookupName(D00400); // RFID → ASCII
SysTimeSTR := SysTime_To_ASCII;
OldTol := D00300;
END_IF;
The flag triggers the mail block, which fires the CMND, and then the flag is cleared on the success status word.
8. SMTP Relay Selection and Authentication
For a corporate environment, point the ETN21 at an internal relay (e.g. smtp.plant.local:25) and let the relay handle TLS, anti-spam, and external delivery. For an isolated cell, an on-network SMTP forwarder such as postfix bound to inet_interfaces = 192.168.10.0/24 is the lightest path. Modern relays requiring AUTH LOGIN work on the ETN21 provided the firmware supports it — confirm against the unit's version label.
Common SMTP error codes that surface in the ETN21 status word:
| Hex | Meaning | Field Action |
|---|---|---|
| 0001 | Command sent | Informational |
| 0002 | Send complete | Clear trigger |
| 0401 | DNS error | Switch to IP-literal for SMTP server |
| 0402 | Socket open failure | Verify port 25/587 not blocked; check ACL |
| 0403 | TCP send failure | Check cable, switch port, duplex mismatch |
| 0404 | No response from server | Confirm relay is up, ping relay IP |
| 1001 | Authentication failed | Re-enter USER/PASS; check for STARTTLS requirement |
| 1002 | Mail rejected by relay | Inspect From: address and reverse-DNS posture |
9. Alternative Architectures
If adding the ETN21 to the rack is undesirable, three workarounds exist:
9.1 SCADA as Mail Client
Install CX-Supervisor, Ignition, or any HMI/SCADA that exposes a "send mail" action bound to a tag. The PLC raises the change bit; the SCADA composes the message and pushes it. This is the most flexible but introduces a Windows box.
9.2 Industrial Gateway with SMTP
A small DIN-rail device (e.g. an Moxa MGate or a Hirschmann RSP) accepts Modbus/TCP or FINS reads from the CJ2H and acts as a mail client. The PLC does not change; the gateway polls for the change bit.
9.3 Cellular SMS / MQTT
If the goal is "alert the right person," SMS via a cellular modem (Sierra Wireless, MultiTech, or a Teltonika TRB) or an MQTT publish to a cloud broker (AWS IoT, Azure IoT Hub) may be a more direct route than email, especially when the recipient is mobile. The CJ1W-ETN21 does not natively support MQTT, so a gateway is again required.
10. Verification Procedure
-
Loopback test: With the PLC offline, manually set
D00500= 1 and watchD00501transition 0 → 1 → 2 within 3 seconds on a local SMTP relay. - Subject/Body inspection: Use a packet capture (Wireshark on the switch mirror port) to confirm the SMTP envelope matches the ASCII buffer.
-
End-to-end test: From the NS10, edit
D00300and confirm the operator's email lands in the manager's inbox with badge ID, old value, and new value. -
Negative test: Disconnect the SMTP cable. Trigger an event.
D00502should report 0x0402 or 0x0404 within the timeout window and the PLC should record a fault in the audit log rather than silently retrying forever.
11. Troubleshooting Matrix
| Symptom | Likely Cause | Action |
|---|---|---|
| ETN21 RDY LED red | Duplicate IP, bad I/O table | Re-transfer I/O table, confirm unique IP |
| Mail never leaves PLC | Trigger word not set or CMND not enabled | Watch D00500 in Watch window |
| Status = 0x0402 | SMTP port blocked by firewall | Add firewall rule for TCP/25 from ETN21 IP |
| Status = 0x1001 | Relay requires STARTTLS or app password | Upgrade ETN21 firmware or use internal relay |
| Mail arrives garbled | Body length miscalculated, odd byte count | Pad body to even length; verify endianness |
| Mail arrives missing operator name | Lookup table empty for badge ID | Populate D04000+ with operator records |
| Duplicate mails on each scan | Trigger not cleared on success | Reset D00500 when D00501 = 2 |
12. Operational Notes and Best Practice
- One-shot, not level-triggered. The CMND instruction must be edge-fired; leaving the trigger word on will re-send mail on every scan and overwhelm the relay.
- Rate limit. The ETN21 mail queue is small. If the change flag can be set by an HMI on every touch, debounce with a 200 ms timer.
-
Audit log mirror. In parallel with the email, append the same event to a circular DM buffer (
D05000..D05199) so a forensic record exists even if the network is down. -
Watchdog. If the status word never leaves
0x0001within 30 s, the PLC should clear the trigger, log a fault, and raise a discrete output to the HMI. - Crypto posture. Email is not a control signal. Use it for notification only; never wire a return path from the mail body to a control action.
13. Summary
The CJ2H-CPU64-EIP is fully capable on EtherNet/IP, but it cannot send email on its own. Adding a CJ1W-ETN21 to the backplane gives the rack a dedicated SMTP client that the PLC drives with a single CMND instruction. With the ASCII subject and body built in ladder from the HMI-entered tolerance, the RFID-looked-up operator name, and a timestamp, the PLC can deliver a complete audit-grade email on every parameter change without a SCADA in the loop. For installations where a SCADA is acceptable, that path remains the most flexible, but for a standalone cell the ETN21 route is the most direct.
Can a CJ2H-CPU64-EIP send email using its built-in Ethernet port?
No. The integrated EtherNet/IP port supports FINS/TCP, socket service, and CIP messaging, but not SMTP. Add a CJ1W-ETN21 Ethernet unit to the rack to gain the mail client.
Which Omron Ethernet unit supports SMTP email?
The CJ1W-ETN21 (and the legacy CJ1W-ETN11). Configure the SMTP server IP, sender address, and authentication in the unit's setup dialog and trigger a MAIL_SEND FINS command (0x2810) with the CMND instruction.
Do I need a SCADA to send the email from the CJ2H?
No. The PLC can send directly through the ETN21 without SCADA. A SCADA is an alternative if you already have one and prefer to keep the rack configuration simple.
How do I include the operator's name in the email body?
Read the badge ID written by the NS10/NS8 HMI into a DM area, look the ID up in a name table in the PLC, copy the resulting ASCII into the ETN21 body buffer, and fire the MAIL_SEND CMND.
What status word indicates the mail was sent successfully?
The ETN21 writes 0x0002 (send complete) to the status word on success. Errors return codes such as 0x0402 (socket failure), 0x0404 (no server response), or 0x1001 (authentication failure). Clear the trigger word only after observing 0x0002.