Replies: 12 comments 7 replies
-
You should mount your SD card first using this function. And in this case error is at your networks included internet, router and your WiFi range. |
Beta Was this translation helpful? Give feedback.
-
Library works normally which it tested intensively and frequently. To make sure all are up to date, please update library and ESP32 core SDK and post the full debug message starting from WiFI connection. The flash filesystem also works well which you can try this example. |
Beta Was this translation helpful? Give feedback.
-
If you see this invalid date/time
This means you are using many years ago obsoleted version library. You should see the message about NTP time reading in the serial monitor and time should be valid otherwise the server will reject your message. Even in no attachment example, if your device time was not set correctly, server may reject your message and quits the connection during the message body was sent. |
Beta Was this translation helpful? Give feedback.
-
After I review your code and see that your library may up to date but It is strange that your device time was not set correctly which the debug message about this is missing from your post. And you should post the full debug message. In the case of NTP reading (synching) failure, it is because internet connection problem or unreliable internet and you should check and try to reset your router, replace your AP or your device. |
Beta Was this translation helpful? Give feedback.
-
as you see both programs reporting connection with the mail server OK. Now I may ask the provider for the attached issue HERE IS THE DEBUG SENDING PLAIN MESSAGE works OK [12:44:22:180] ets Jun 8 2016 00:22:57␍␊ THIS IS THE PROGRAM TO SEND THE FILE. File is writen in SD and checked (image can not be read fro PC but that is no problem i suppose). THIS IS NOT WORKING. TIMEOUT ERROR /**
*/ /** ////////////////////////////////////////////////
*/ /** Assign SD card type and FS used in src/ESP_Mail_FS.h and
#include <Arduino.h> // Other Client defined here #endif #include <ESP_Mail_Client.h> // Provide the SD card interfaces setting and mounting #define WIFI_SSID "LABX" /** For Gmail, the app password will be used for log in
/** The smtp host name e.g. smtp.gmail.com for GMail or smtp.office365.com for Outlook or smtp.mail.yahoo.com */ /* Declare the global used SMTPSession object for SMTP transport */ /* Callback function to get the Email sending status */ #if defined(ARDUINO_RASPBERRY_PI_PICO_W) void setup() Serial.begin(115200); #if defined(ARDUINO_ARCH_SAMD) Serial.println(); #if defined(ARDUINO_RASPBERRY_PI_PICO_W) Serial.print("Connecting to Wi-Fi"); #if defined(ARDUINO_RASPBERRY_PI_PICO_W) while (WiFi.status() != WL_CONNECTED) #if defined(ESP_MAIL_DEFAULT_SD_FS) // defined in src/ESP_Mail_FS.h // Mount SD card. Serial.println("Preparing SD file attachments..."); const char *orangeImg = "iVBORw0KGgoAAAANSUhEUgAAAGQAAABkCAYAAABw4pVUAAAAoUlEQVR42u3RMQ0AMAgAsCFgftHLiQpsENJaaFT+fqwRQoQgRAhChCBECEKECBGCECEIEYIQIQgRghCECEGIEIQIQYgQhCBECEKEIEQIQoQgBCFCECIEIUIQIgQhCBGCECEIEYIQIQhBiBCECEGIEIQIQQhChCBECEKEIEQIQhAiBCFCECIEIUIQghAhCBGCECEIEYIQIUKEIEQIQoQg5LoBGi/oCaOpTXoAAAAASUVORK5CYII="; // Write demo data to file static uint8_t buf[512]; // SDFat? file.open("/bin1.dat", O_RDWR | O_CREAT); size_t i; for (i = 0; i < 4; i++) buf[0] = 'T'; #else #if defined(ESP32) #if defined(ESP32) buf[0] = 'H'; size_t i; for (i = 0; i < 4; i++) buf[0] = 'T'; #endif /* Set the network reconnection option */ // The WiFi credentials are required for Pico W /** Enable the debug via Serial port
/* Set the callback function to get the sending results */ /* Declare the Session_Config for user defined session credentials */ /* Set the session config */ /** Assign your host name or you public IPv4 or IPv6 only
/* /* Declare the message class */ /* Enable the chunked data transfer with pipelining for large message if server supported */ /* Set the message headers */ message.subject = F("Test sending Email with attachments and inline images from SD card and Flash"); message.addRecipient(F("user1"), RECIPIENT_EMAIL); /** Two alternative content versions are sending in this example e.g. plain text and html */ message.html.content = htmlMsg; /** The HTML text message character set e.g.
/** The content transfer encoding e.g.
message.text.content = F("This message contains 1 inline image and 1 attachment file.\r\nThe inline image will not show in the plain text message."); message.text.charSet = F("utf-8"); /** The message priority
/** The Delivery Status Notifications e.g.
/* Set the custom message header */ /* The attachment data item */ /** Set the inline image info e.g.
/** The file storage type e.g.
/* Need to be base64 transfer encoding for inline image */ /** The orange.png file is already base64 encoded file.
/* Add inline image to the message */ /** Set the attachment info e.g.
attIndex++; /* Add attachment to the message */ /* Connect to the server */ if (smtp.isAuthenticated()) /* Start sending the Email and close the session */ // to clear sending result log ESP_MAIL_PRINTF("Free Heap: %d\n", MailClient.getFreeHeap()); void loop() /* Callback function to get the Email sending status / /* Print the sending result */
} THIS IS THE DEBUG FROM THE ABOVE PROGRAM [12:51:26:994] ets Jun 8 2016 00:22:57␍␊ I do nor really know where "[12:52:06:443] #### Date/Time: January 01, 1970 00:00:00␍␊" comes from |
Beta Was this translation helpful? Give feedback.
-
After test, I can confirm that the library works fine in ESP32 Core v2.0.10. This is the message from the callback function which indicates the sending process exits before the internal timestamp of sending time was set.
|
Beta Was this translation helpful? Give feedback.
-
When the supply voltage drops because of too weak power supply during WiFi and SD card consume more current to work, it affected mcu operation included timer, clock and WiFi may fail to work. |
Beta Was this translation helpful? Give feedback.
-
HI @mobizt here we are. I am really confused and leave's me one last attempt. To both check the same program using a google account. This is my last chance since we have a common ground (same provider) to make the test. |
Beta Was this translation helpful? Give feedback.
-
So I will make 2-step verification OFF. No problem. What next?
…On Wed, Jul 19, 2023 at 8:29 PM Suwatchai K. ***@***.***> wrote:
The library supports authentication methods that supported by IMAP and
SMTP servers e.g., PLAIN, LOGIN and XOAUTH2 through its extensions that
advertised during server connection greeting.
Other authentication flows e.g. 2-step verification is not related to IMAP
and SMTP standards, and it's not supported in this library.
—
Reply to this email directly, view it on GitHub
<#276 (reply in thread)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ADK6RSRRRMWCN3SZLLSAAJDXRAKN7ANCNFSM6AAAAAA2PEVMBE>
.
You are receiving this because you authored the thread.Message ID:
***@***.***>
--
Vasilis Vorrias
R&D Electronics and Automation
email: ***@***.***
linkedin.com/in/vasilis-vorrias-586805176
<https://www.linkedin.com/in/vasilis-vorrias-586805176>
M10CUBE project: https://gitlab.com/m10cube/m10
|
Beta Was this translation helpful? Give feedback.
-
Instead of asking the new topic other than you have created, you should post in the new discussion. |
Beta Was this translation helpful? Give feedback.
-
@mobizt sorry is the differences in expressing the language. Thank you |
Beta Was this translation helpful? Give feedback.
-
Yes reading your read-me file I found how to use "app password as usual." using Google SMTP_HOST smtp.gmail.com PORT 587. I will look in more detail your notes on "security issue of using user and passwords" and if I have any questions I will come back. Thanks again PS. Please tell me how to buy you a coffee. |
Beta Was this translation helpful? Give feedback.
-
Thank you for your great library.
I am trying all day to figure out why this is happening.
The program sending plan email works fine but the program sending attached files not.
I am using
here is the debug messages:
22:29:52.777 -> < S: 250-8BITMIME
22:29:52.777 -> < S: 250-DSN
22:29:52.777 -> < S: 250 CHUNKING
22:29:52.777 ->
22:29:52.777 -> #### Logging in...
22:29:52.777 -> > C: send SMTP command, AUTH PLAIN
22:29:52.777 -> > C: vorrias@pan-gaea.gr
22:29:52.777 -> > C: **************
22:30:03.292 -> < S: 235 2.7.0 Authentication successful
22:30:03.292 ->
22:30:03.292 -> Successfully logged in.
22:30:03.292 ->
22:30:03.292 -> #### Sending Email...
22:30:03.292 -> > C: send Email
22:30:03.292 ->
22:30:03.292 -> #### Sending message header...
22:30:03.292 -> > C: send message header
22:30:04.708 -> < S: 250 2.1.0 Ok
22:30:04.997 -> < S: 250 2.1.5 Ok
22:30:04.997 ->
22:30:04.997 -> #### Sending message body...
22:30:04.997 -> > C: send message body
22:30:35.006 -> > C: cleaning SSL connection
22:30:35.037 -> #### Error, session timed out
22:30:35.037 -> ! E: session timed out
22:30:35.037 ->
22:30:35.037 -> #### -------------------------
22:30:35.037 -> #### Message sent success: 0
22:30:35.037 -> #### Message sent failed: 1
22:30:35.037 -> #### -------------------------
22:30:35.037 -> #### Status: failed
22:30:35.037 -> #### Date/Time: January 01, 1970 00:00:00
22:30:35.037 -> #### Recipient: vorrias.argo@gmail.com
22:30:35.037 -> #### Subject: Test sending Email with attachments and inline
here is my code
Any help will be greatly appreciated.
Thank you
Beta Was this translation helpful? Give feedback.
All reactions