Skip to content

Commit

Permalink
Fix SMTP message address-list issue #348.
Browse files Browse the repository at this point in the history
  • Loading branch information
mobizt committed Jul 20, 2024
1 parent 7efbf5b commit d721546
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 10 deletions.
2 changes: 1 addition & 1 deletion library.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "ESP Mail Client",
"version": "3.4.20",
"version": "3.4.21",
"keywords": "communication, email, imap, smtp, esp32, esp8266, samd, arduino",
"description": "Arduino E-Mail Client Library to send, read and get incoming email notification for ESP32, ESP8266 and SAMD21 devices. The library also supported other Arduino Devices using Clients interfaces e.g. WiFiClient, EthernetClient, and GSMClient.",
"repository": {
Expand Down
2 changes: 1 addition & 1 deletion library.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name=ESP Mail Client

version=3.4.20
version=3.4.21

author=Mobizt

Expand Down
2 changes: 1 addition & 1 deletion src/ESP_Mail_Client.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
/**
* Mail Client Arduino Library for Arduino devices.
*
* Created July 15, 2024
* Created July 19, 2024
*
* This library allows Espressif's ESP32, ESP8266, SAMD and RP2040 Pico devices to send and read Email through the SMTP and IMAP servers.
*
Expand Down
4 changes: 2 additions & 2 deletions src/ESP_Mail_Client_Version.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@

#ifndef ESP_MAIL_VERSION

#define ESP_MAIL_VERSION "3.4.20"
#define ESP_MAIL_VERSION_NUM 30420
#define ESP_MAIL_VERSION "3.4.21"
#define ESP_MAIL_VERSION_NUM 30421

/* The inconsistent file version checking to prevent mixed versions compilation. */
//#define VALID_VERSION_CHECK(ver) (ver == ESP_MAIL_VERSION_NUM)
Expand Down
15 changes: 10 additions & 5 deletions src/ESP_Mail_SMTP.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
/**
* Mail Client Arduino Library for Espressif's ESP32 and ESP8266, Raspberry Pi RP2040 Pico, and SAMD21 with u-blox NINA-W102 WiFi/Bluetooth module
*
* Created August 28, 2023
* Created July 19, 2024
*
* This library allows Espressif's ESP32, ESP8266, SAMD and RP2040 Pico devices to send and read Email through the SMTP and IMAP servers.
*
Expand Down Expand Up @@ -318,7 +318,8 @@ bool ESP_Mail_Client::addSendingResult(SMTPSession *smtp, SMTP_Message *msg, boo
if (msg->timestamp.tag.length() && msg->timestamp.format.length())
status.subject.replaceAll(msg->timestamp.tag, Time.getDateTimeString(Time.getCurrentTimestamp(), msg->timestamp.format.c_str()));

status.recipients = msg->_rcp[0].email.c_str();
if (msg->_rcp.size())
status.recipients = msg->_rcp[0].email.c_str();
smtp->sendingResult.add(&status);

smtp->_cbData._sentSuccess = smtp->_sentSuccessCount;
Expand Down Expand Up @@ -346,8 +347,11 @@ bool ESP_Mail_Client::addSendingResult(SMTPSession *smtp, SMTP_Message *msg, boo
sendCallback<SMTPSession *>(smtp, buf, false, false);
snprintf(buf, bufLen, pgm2Str(esp_mail_str_96 /* "Date/Time: %s" */), Time.getDateTimeString(ts, "%B %d, %Y %H:%M:%S").c_str());
sendCallback<SMTPSession *>(smtp, buf, false, false);
snprintf(buf, bufLen, pgm2Str(esp_mail_str_97 /* "Recipient: %s" */), msg->_rcp[0].email.c_str());
sendCallback<SMTPSession *>(smtp, buf, false, false);
if (msg->_rcp.size())
{
snprintf(buf, bufLen, pgm2Str(esp_mail_str_97 /* "Recipient: %s" */), msg->_rcp[0].email.c_str());
sendCallback<SMTPSession *>(smtp, buf, false, false);
}
snprintf(buf, bufLen, pgm2Str(esp_mail_str_92 /* "Subject: %s" */), msg->subject.c_str());
sendCallback<SMTPSession *>(smtp, buf, false, false);
freeMem(&buf);
Expand All @@ -372,7 +376,8 @@ void ESP_Mail_Client::saveSendingLogs(SMTPSession *smtp, SMTP_Message *msg, bool
mbfs->print(mbfs_type smtp->_session_cfg->sentLogs.storage_type, cm.c_str());
mbfs->print(mbfs_type smtp->_session_cfg->sentLogs.storage_type, (int)smtp->ts);
mbfs->print(mbfs_type smtp->_session_cfg->sentLogs.storage_type, cm.c_str());
mbfs->print(mbfs_type smtp->_session_cfg->sentLogs.storage_type, msg->_rcp[0].email.c_str());
if (msg->_rcp.size())
mbfs->print(mbfs_type smtp->_session_cfg->sentLogs.storage_type, msg->_rcp[0].email.c_str());
mbfs->print(mbfs_type smtp->_session_cfg->sentLogs.storage_type, cm.c_str());
mbfs->println(mbfs_type smtp->_session_cfg->sentLogs.storage_type, msg->subject.c_str());
mbfs->close(mbfs_type smtp->_session_cfg->sentLogs.storage_type);
Expand Down

0 comments on commit d721546

Please sign in to comment.