This is more a summary about what I found out about the built in SMTP behavior than a question, since I guess we have to live with it as is.
For some time I am trying to get the SMTP_SEND to work on a NX-3200 with my own SMTP server without any luck. Netlinx always returned MailSenderPrivate::Send authentication error 4 (Unknown error code) or (TLS not supported by server). With some logging I come to the following conclusions:
- If the mail server supports STARTTLS, it always uses TLS, no matter how SMTP_REQUIRE_TLS is set.
- Once you set SMTP_TLS_TRUE, SMTP_SEND always seems to require TLS support, no matter how SMTP_REQUIRE_TLS is set. It then always sends a STARTTLS command or shows the (TLS not supported by server) error. If you want to set it back to SMTP_TLS_FALSE you have to reboot the NX afterwards.
- it requires AUTH LOGIN PLAIN support. If only AUTH LOGIN is enabled, it QUITs right after the TLS handshake.
- With AUTH LOGIN PLAIN support after the TLS handshake it sends a AUTH PLAIN + BASE64 encode string. The encoded string should contain the SMTP_USERNAME and SMTP_PASSWORD. But Netlinx sends SMTP_USERNAME SMTP_USERNAME SMTP_PASSWORD which, at least with my mail server, results in an 535 Authentication failed error.
I have no clue why the username is sent twice, but it looks like the built in SMTP functionality is totally flawed and mostly useless (using the latest controller firmware 1.6.179)