EmailSender with Gmail

Home Forums Arduino EmailSender with Gmail

Viewing 7 reply threads
  • Author
    Posts
    • #33365
      Jules
      Participant

        Hello Renzo,
        Since my Sendgrid account has become paid, I turned to Google. (I don’t send enough emails to be profitable).
        On my Google account, I created an API key, but I can’t send an email.
        I kept the same structure as for sending with Sendgrid.
        But I can’t send the email.

        code :
        #include <EMailSender.h>
        #define DEFAULT_EMAIL_NETWORK_TYPE_ARDUINO NETWORK_W5100
        #define EMAIL_SENDER_DEBUG
        EMailSender.emailSend(“Arduino”, “aaaa bbbb cccc dddd”, “xxxxxxxxx@gmail.com”, “smtp.gmail.com”, 587);

        I tested with the names ‘Apikey’ and ‘Arduino’. Arduino is the name registered with the Google API.
        I am testing several solutions, but I feel like I am missing something simple…

        The server response is: SMTP AUTH error (530 5.7.0

        Do you have any idea what might be missing?
        I am using a Mega2500 board.
        Tank you

        • This topic was modified 1 month, 2 weeks ago by Jules.
        • This topic was modified 1 month, 2 weeks ago by Jules.
      • #33375
        Jules
        Participant

          ok ok I understand now:

          smtp.gmail.com requires a TLS/SSL connection and an App Password if you are using a Google account (2-step verification). The standard W5100 (Ethernet) shield does not support TLS/SSL, so it cannot connect directly to smtp.gmail.com over 465 (SSL) or perform STARTTLS over 587

          So, I’ll look for another solution.

          You can close this topic.

        • #33409
          Renzo Mischianti
          Keymaster

            Hi Jules,
            You are right, I try to upgrade the EmailSender, but for Mega I think the requirements for 587 are too high.
            Keep in touch.
            Bye Renzo

          • #33410
            Renzo Mischianti
            Keymaster

              Wait, for w5500 I do this work that I think can be suitable also for Mega

              STM32 send emails with attachments and SSL (like Gmail): w5500, enc28j60, SD, and SPI Fash

              Give me a feedback Renzo

            • #33456
              Renzo Mischianti
              Keymaster

                Hi Jules 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

              • #33463
                Jules
                Participant

                  weird, with v4, it no longer recognizes EmailSender.h
                  Here’s the message for a program check :

                  “fatal error: EMailSender.h: No such file or directory
                  #include “EMailSender.h”
                  ^~~~~~~~~~~~~~~
                  compilation terminated.
                  exit status 1

                  Compilation error: EMailSender.h: No such file or directory”

                • #33466
                  Renzo Mischianti
                  Keymaster

                    I did some fixes, please retry.
                    I tested Arduino Mega with Brevo service, and it works correctly without SSL.
                    I also added a specified example.

                    Please give me feedback.
                    Bye Renzo

                  • #33474
                    Jules
                    Participant

                      The test works well with version 4 of EmailSender.
                      The Brevo site sends me emails perfectly.
                      There’s a small error in your sketch: there’s a space missing in the “const char *” command.

                      Thank you.

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