Stuck: SMTP AUTH error (500 unrecognized command )

Viewing 4 reply threads
  • Author
    Posts
    • #33342
      Bruce
      Participant

        Hello,

        Ciao Renzo for all the hard work!

        I am SO wanting my Arduino controller boards I make for clients / projects to email daily log files. Its been a long long road. Seems to simple yet so complex.

        I am now using Due clone (ARM Cortex-M3 CPU) and SPI W5500 wired Ethernet, SD etc That all works okay, and I can run the https test okay.

        But I need to use my own smtp server with TLS port 587. Serer has been tested independently.

        The config is:

        EMailSender emailSend(“eman@wisenet.co.za”,”passsswqord”,”eman@wisenet.co.za”,”smtp.wisenet.co.za”,587);

        Running my test, which is much the same as the STM32w5500_GMail_SSL_Attach_SD example, I get this on the serial monitor:

        Initializing SD card…initialization done.
        Begin Ethernet
        DHCP OK
        Ethernet Successfully Initialized
        Local IP : 192.168.0.109
        Subnet Mask : 255.255.255.0
        Gateway IP : 192.168.0.1
        DNS Server : 192.168.0.1
        Write file content!
        All structure created!
        Sending status:
        0
        235
        SMTP AUTH error (500 unrecognized command)

        So its talking to the SMTP Server but can’t authenticate…?

        I generated trust_anchor.h for wisenet.co.za,smtp.wisenet.co.za and that is in the sketch folder

        I uncommented
        #define SSLCLIENT_WRAPPER

        As I say h/w is all tested okay with all works with the https: test example

        One thing, I can’t use #include <EthernetLarge.h> it generates reams of errors like
        libraries\EthernetLarge-master\Dhcp.cpp.o:C:\Users\User\Documents\Arduino\libraries\EthernetLarge-master\src/Dhcp.cpp:29: first defined here

        libraries\Ethernet\Dhcp.cpp.o: In function `__static_initialization_and_destruction_0′:

        So I am using #include <Ethernet.h>

        Any advise highly appreciated, I really would like to get this working

        Thanks.

        Bruce

        • This topic was modified 1 month, 4 weeks ago by Bruce.
      • #33344
        Bruce
        Participant

          This is the test results from the SMTP server

          This mail was directly sent by smtp.wisenet.co.za.

          SMTP host: smtp.wisenet.co.za
          Port: 587
          Use SLL: True
          Use Authentication: True
          Authentication name: eman@wisenet.co.za
          Authentication password: [not applicable]
          Email from: eman@wisenet.co.za
          Email to: kosmos303@gmail.com

          This service is provided by https://smtper.net

        • #33347
          Renzo Mischianti
          Keymaster

            Hi Bruce,
            The library supports only SSL/TLS handled on port 465, the EmailSender library doesn’t support the STARTTLS command required for port 587.
            I try to upgrade in the future, but now you can check the tutorial on this site.

            Send emails with attachments: Arduino SAMD boards (WiFiNINA) – 3

            Bye Renzo

          • #33352
            Bruce
            Participant

              Thank you for the reply. Seems a dead end then with the ISP I use.

              I have my own hosted Centos server which I use for DNS and mqtt, I could set up a dedicated mail server specifically for this that will talk SSL/TLD on port 465

              What would you suggest as the best route to go on Centos? Old tried and tested Postfix?

              I did try the gmail option, I could not get it to work, but not really keen on being dependent on google services.

              thanks again,
              Bruce

            • #33454
              Renzo Mischianti
              Keymaster

                Hi Bruce sorry for the late response,
                However, I received some requests for this library, and I began to add extensive support. I developed and added numerous features. In the GitHub branch repository, you can find an updated version of the library (Beta version) that try to support SSL on port 465 also for AVR system.
                If you can give me some feedback.

                Release v4.0.0: Add STARTTLS support and comprehensive documentation

                Major Features:
                – ✨ Add full STARTTLS support (port 587) for secure email transmission
                – ✨ Integrate internal SSLClient for ESP32/ESP8266 STARTTLS connections
                – ✨ Enhance authentication methods (AUTH LOGIN, PLAIN, CRAM-MD5)
                – ✨ Add comprehensive English documentation with platform-specific tutorials

                Improvements:
                – 🔧 Unify client handling for better SSL/TLS compatibility
                – 🔧 Improve EHLO/HELO command handling with multi-line response support
                – 🔧 Enhance connection retry logic and error handling
                – 🔧 Better memory management for large attachments
                – 🔧 Add detailed SMTP response drain mechanism

                Bug Fixes:
                – 🐛 Fix SSLClient initialization and scope issues on ESP32
                – 🐛 Fix STARTTLS upgrade sequence for proper SSL handshake
                – 🐛 Correct BearSSL integration for Ethernet shields
                – 🐛 Fix client reference handling in send() method

                Documentation:
                – 📚 Add complete README.md with all features and examples
                – 📚 Include links to mischianti.org tutorials for all platforms
                – 📚 Add troubleshooting guide and Gmail configuration instructions
                – 📚 Document API reference with all methods and data structures
                – 📚 Add migration guide from v3.x to v4.0.0

                Breaking Changes:
                – ⚠️ Minimum Arduino IDE version: 1.8.x
                – ⚠️ ESP32 core minimum version: 2.0.x
                – ⚠️ Some internal API changes (user-facing API remains compatible)

                Tested Platforms:
                – ESP32 (WiFi + Ethernet with STARTTLS/SSL)
                – ESP8266 (WiFi + Ethernet with STARTTLS/SSL)
                – Arduino Mega (Ethernet with SSLClient)
                – Arduino SAMD (WiFiNINA)
                – STM32 (Ethernet with SSL)
                – Raspberry Pi Pico W (WiFi + LittleFS)

                This release brings production-ready STARTTLS support making the library
                compatible with modern SMTP servers requiring port 587 encryption, while
                maintaining backward compatibility with implicit SSL on port 465.

                Bye Renzo

            Viewing 4 reply threads
            • You must be logged in to reply to this topic.
            Exit mobile version