• Skip to main content
  • Skip to primary sidebar

RNTLab.com

The Ultimate Shortcut to Learn Electronics and Programming with Open Source Hardware and Software

  • Courses
  • Forum
    • Forum
    • Ask Question
  • Shop
  • Account
  • Blog
  • Login

ESP32 Send Emails using an SMTP Server: HTML, Text and Attachments (Arduino IDE)

Q&A Forum › Category: ESP32 › ESP32 Send Emails using an SMTP Server: HTML, Text and Attachments (Arduino IDE)
1 Vote Up Vote Down
Dean Cotton asked 2 years ago

Hello
I am having a problem with the attachments not being attached from the example code.

I only have the text file. I removed the image and all of its associated code as I only need the .txt to work.
The email sends but the attachments don’t appear, the serial monitor below says it doesn’t see the file how can i fix it?
====================SERIAL MONITOR BEGIN====================
SPIFFS mounted successfully
#### Connecting to SMTP server…
> C: ESP Mail Client v3.1.7
> C: wait for NTP server time synching
./components/esp_littlefs/src/littlefs/lfs.c:1229:error: Corrupted dir pair at {0x0, 0x1}
E (11451) esp_littlefs: mount failed, (-84)
E (11451) esp_littlefs: Failed to initialize LittleFS
#### Error, NTP server time synching timed out
! E: NTP server time synching timed out
> C: connecting to SMTP server
> C: Host > smtp.gmail.com
> C: Port > 465
> C: SSL/TLS negotiation
> C: seeding the random number generator
> C: setting up the SSL/TLS structure
! W: Skipping SSL Verification. INSECURE!
> C: setting hostname for TLS session
> C: perform the SSL/TLS handshake
> C: verifying peer X.509 certificate
#### SMTP server connected
> C: SMTP server connected, wait for greeting…
< S: 220 smtp.gmail.com ESMTP u8-20020adfeb48000000b003062b2c5255sm515369wrn.40 – gsmtp
#### Sending greeting response…
> C: send SMTP command, HELO
< S: 250-smtp.gmail.com at your service, [196.220.191.53]
< S: 250-SIZE 35882577
< S: 250-8BITMIME
< S: 250-AUTH LOGIN PLAIN XOAUTH2 PLAIN-CLIENTTOKEN OAUTHBEARER XOAUTH
< S: 250-ENHANCEDSTATUSCODES
< S: 250-PIPELINING
< S: 250-CHUNKING
< S: 250 SMTPUTF8
#### Logging in…
> C: send SMTP command, AUTH PLAIN
> C: deancotton02@gmail.com
> C: ****************
< S: 235 2.7.0 Accepted
#### Sending Email…
> C: send Email
#### Sending message header…
> C: send message header
< S: 250 2.1.0 OK u8-20020adfeb48000000b003062b2c5255sm515369wrn.40 – gsmtp
< S: 250 2.1.5 OK u8-20020adfeb48000000b003062b2c5255sm515369wrn.40 – gsmtp
#### Sending message body…
> C: send message body
< S: 354 Go ahead u8-20020adfeb48000000b003062b2c5255sm515369wrn.40 – gsmtp
#### Sending attachments…
> C: send attachments
#### text_file.txt
> C: text_file.txt
> C: file does not exist or can’t access
! E: file not found.
#### Finishing the message sending…
> C: finishing the message sending
< S: 250 2.0.0 OK 1686205634 u8-20020adfeb48000000b003062b2c5255sm515369wrn.40 – gsmtp
#### Closing the session…
> C: terminate the SMTP session
#### Message sent successfully
> C: message sent successfully
—————-
Message sent success: 1
Message sent failled: 0
—————-
Message No: 1
Status: success
Date/Time: 1970/1/1 0:0:20
Recipient: deancotton02@gmail.com
Subject: Test sending Email with attachments and inline images from Flash
—————-
C: cleaning SSL connection
====================SERIAL MONITOR END====================

Question Tags: Email attachments
1 Answers
0 Vote Up Vote Down
Rui Santos Staff answered 2 years ago

Hi.
Can you tell me what example exaclty are you following?
What version of the library are you using?
What version of the ESP32 boards installation do you have? (Tools > Boards > Boards Manager , search for ESP32 and check the version).
 
Regards,
Rui

Primary Sidebar

Login to Ask or Answer Questions

This Forum is private and it’s only available for members enrolled in our Courses.

Login »

Latest Course Updates

  • [New Edition] Build ESP32-CAM Projects eBook – 2nd Edition April 16, 2025
  • [eBook Updated] Learn ESP32 with Arduino IDE eBook – Version 3.2 April 16, 2025

You must be logged in to view this content.

Contact Support - Refunds - Privacy - Terms - MakerAdvisor.com - Member Login

Copyright © 2013-2025 · RandomNerdTutorials.com · All Rights Reserved

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.