Skip to content

Commit 6d1b900

Browse files
committed
Fix IMAP's file name and decoding issues
1 parent 9759435 commit 6d1b900

File tree

23 files changed

+64
-64
lines changed

23 files changed

+64
-64
lines changed

README.md

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ ssl_client.setInsecure();
6666

6767
auto statusCallback = [](SMTPStatus status){ Serial.println(status.text); };
6868

69-
smtp.connect("smtp host here", 465, "127.0.0.1", statusCallback);
69+
smtp.connect("smtp host here", 465, statusCallback);
7070
if (smtp.isConnected())
7171
{
7272
smtp.authenticate("sender email here", "sender email password here", readymail_auth_password);
@@ -120,9 +120,13 @@ Plese check the library's [examples](/examples/Sending/) for the changes.
120120
**Host/Domain or Public IP**
121121
122122
User should provides the host name or you public IPv4 or IPv6 to the third parameter of `SMTPClient::connect()` function.
123+
123124
This information is the part of `EHLO/HELO` SMTP command to identify the client system to prevent connection rejection.
124125
125-
If host name or public IP is not available, ignore this or use the loopback address `127.0.0.1`. This library will set the loopback address `127.0.0.1` to the `EHLO/HELO` SMTP command for the case that user provides blank, invalid host and IP to this parameter.
126+
If host name or public IP is not available, ignore this or use the loopback address `127.0.0.1`. This library will set the loopback address `127.0.0.1` to the `EHLO/HELO` SMTP command for the case that user provides blank, invalid host and IP to this parameter or setting `SMTPResponseCallback` as the third parameter.
127+
128+
Note that, for general use case, the domain/ip was ignored by setting `SMTPResponseCallback` as the third parameter of `SMTPClient::connect()` in all library SMTP examples and example codes that showed in this document.
129+
126130
127131
**Date Header**
128132
@@ -471,7 +475,7 @@ WiFiClient basic_client; // Network client
471475
SMTPClient smtp(basic_client);
472476

473477
auto statusCallback = [](IMAPStatus status){ Serial.println(status.text);};
474-
smtp.connect("smtp host", 25, "127.0.0.1", statusCallback, false /* non-secure */);
478+
smtp.connect("smtp host", 25, statusCallback, false /* non-secure */);
475479

476480
```
477481
**IMAP Port 143**
@@ -515,7 +519,7 @@ ssl_client.setClient(&basic_client, false /* starts connection in plain text */)
515519
ssl_client.setInsecure();
516520

517521
auto statusCallback = [](IMAPStatus status){ Serial.println(status.text);};
518-
smtp.connect("smtp host", 587, "127.0.0.1", statusCallback);
522+
smtp.connect("smtp host", 587, statusCallback);
519523

520524
```
521525
@@ -532,7 +536,7 @@ ssl_client.setInsecure();
532536
ssl_client.setPlainStart();
533537
534538
auto statusCallback = [](IMAPStatus status){ Serial.println(status.text);};
535-
smtp.connect("smtp host", 587, "127.0.0.1", statusCallback);
539+
smtp.connect("smtp host", 587, statusCallback);
536540
537541
```
538542

@@ -593,7 +597,7 @@ ssl_client.setClient(&basic_client);
593597
ssl_client.setInsecure();
594598

595599
auto statusCallback = [](IMAPStatus status){ Serial.println(status.text); };
596-
smtp.connect("smtp host", 465, "127.0.0.1", statusCallback);
600+
smtp.connect("smtp host", 465, statusCallback);
597601

598602
```
599603
@@ -607,7 +611,7 @@ WiFiClientSecure ssl_client;
607611
SMTPClient smtp(ssl_client);
608612
609613
auto statusCallback = [](IMAPStatus status){ Serial.println(status.text); };
610-
smtp.connect("smtp host", 465, "127.0.0.1", statusCallback);
614+
smtp.connect("smtp host", 465, statusCallback);
611615
612616
```
613617

examples/Network/AutoClient/AutoClient.ino

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@
2828
#include <ReadyMail.h>
2929

3030
#define SMTP_HOST "_______"
31-
#define DOMAIN_OR_IP "127.0.0.1"
3231
#define AUTHOR_EMAIL "_______"
3332
#define AUTHOR_PASSWORD "_______"
3433
#define RECIPIENT_EMAIL "_______"
@@ -59,7 +58,7 @@ void smtpCb(SMTPStatus status)
5958
void sendEmail(int port)
6059
{
6160

62-
smtp.connect(SMTP_HOST, port, "127.0.0.1", smtpCb);
61+
smtp.connect(SMTP_HOST, port, smtpCb);
6362
if (!smtp.isConnected())
6463
return;
6564

examples/Network/AutoPort/AutoPort.ino

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
#include <ReadyMail.h>
1414

1515
#define SMTP_HOST "_______"
16-
#define DOMAIN_OR_IP "127.0.0.1"
1716
#define AUTHOR_EMAIL "_______"
1817
#define AUTHOR_PASSWORD "_______"
1918
#define RECIPIENT_EMAIL "_______"
@@ -61,7 +60,7 @@ void sendEmail(int port)
6160

6261
// Everytime you call connect(), the previouse session will stop.
6362
// If you want to reuse the session, just skipping the connect() and authenticate().
64-
smtp.connect(SMTP_HOST, port, "127.0.0.1", smtpCb, ssl);
63+
smtp.connect(SMTP_HOST, port, smtpCb, ssl);
6564
if (!smtp.isConnected())
6665
return;
6766

examples/Network/EthernetClient/EthernetClient.ino

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ EthernetClient basic_client;
2828

2929
#define SMTP_HOST "_______"
3030
#define SMTP_PORT 465
31-
#define DOMAIN_OR_IP "127.0.0.1"
3231

3332
// https://github.com/mobizt/ESP_SSLClient
3433
ESP_SSLClient ssl_client;
@@ -94,7 +93,7 @@ void setup()
9493

9594
// In case ESP8266 crashes, please see https://bit.ly/4iX1NkO
9695

97-
smtp.connect(SMTP_HOST, SMTP_PORT, DOMAIN_OR_IP, smtpCb);
96+
smtp.connect(SMTP_HOST, SMTP_PORT, smtpCb);
9897
if (!smtp.isConnected())
9998
return;
10099
}

examples/Network/GSMClient/GSMClient.ino

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,6 @@ const char gprsPass[] = "";
4040

4141
#define SMTP_HOST "_______"
4242
#define SMTP_PORT 465
43-
#define DOMAIN_OR_IP "127.0.0.1"
4443

4544
TinyGsm modem(SerialAT);
4645
TinyGsmClient basic_client(modem);
@@ -136,7 +135,7 @@ void setup()
136135

137136
// In case ESP8266 crashes, please see https://bit.ly/4iX1NkO
138137

139-
smtp.connect(SMTP_HOST, SMTP_PORT, DOMAIN_OR_IP, smtpCb);
138+
smtp.connect(SMTP_HOST, SMTP_PORT, smtpCb);
140139
if (!smtp.isConnected())
141140
return;
142141
}

examples/Sending/Attachment/Attachment.ino

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414

1515
#define SMTP_HOST "_______"
1616
#define SMTP_PORT 465 // SSL or 587 for STARTTLS
17-
#define DOMAIN_OR_IP "127.0.0.1"
1817
#define AUTHOR_EMAIL "_______"
1918
#define AUTHOR_PASSWORD "_______"
2019
#define RECIPIENT_EMAIL "_______"
@@ -134,7 +133,7 @@ void setup()
134133

135134
// In case ESP8266 crashes, please see https://bit.ly/4iX1NkO
136135

137-
smtp.connect(SMTP_HOST, SMTP_PORT, DOMAIN_OR_IP, smtpCb);
136+
smtp.connect(SMTP_HOST, SMTP_PORT, smtpCb);
138137
if (!smtp.isConnected())
139138
return;
140139

examples/Sending/ESP32Camera/ESP32Camera.ino

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@
3636

3737
#define SMTP_HOST "_______"
3838
#define SMTP_PORT 465 // SSL or 587 for STARTTLS
39-
#define DOMAIN_OR_IP "127.0.0.1"
4039
#define AUTHOR_EMAIL "_______"
4140
#define AUTHOR_PASSWORD "_______"
4241
#define RECIPIENT_EMAIL "_______"
@@ -127,7 +126,7 @@ void setup()
127126

128127
Serial.println("ReadyMail, version " + String(READYMAIL_VERSION));
129128

130-
smtp.connect(SMTP_HOST, SMTP_PORT, DOMAIN_OR_IP, smtpCb);
129+
smtp.connect(SMTP_HOST, SMTP_PORT, smtpCb);
131130
if (!smtp.isConnected())
132131
return;
133132

examples/Sending/InlineImage/InlineImage.ino

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313

1414
#define SMTP_HOST "_______"
1515
#define SMTP_PORT 465 // SSL or 587 for STARTTLS
16-
#define DOMAIN_OR_IP "127.0.0.1"
1716
#define AUTHOR_EMAIL "_______"
1817
#define AUTHOR_PASSWORD "_______"
1918
#define RECIPIENT_EMAIL "_______"
@@ -84,7 +83,7 @@ void setup()
8483

8584
// In case ESP8266 crashes, please see https://bit.ly/4iX1NkO
8685

87-
smtp.connect(SMTP_HOST, SMTP_PORT, DOMAIN_OR_IP, smtpCb);
86+
smtp.connect(SMTP_HOST, SMTP_PORT, smtpCb);
8887
if (!smtp.isConnected())
8988
return;
9089

examples/Sending/RFC822Message/RFC822Message.ino

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313

1414
#define SMTP_HOST "_______"
1515
#define SMTP_PORT 465 // SSL or 587 for STARTTLS
16-
#define DOMAIN_OR_IP "127.0.0.1"
1716
#define AUTHOR_EMAIL "_______"
1817
#define AUTHOR_PASSWORD "_______"
1918
#define RECIPIENT_EMAIL "_______"
@@ -152,7 +151,7 @@ void setup()
152151

153152
// In case ESP8266 crashes, please see https://bit.ly/4iX1NkO
154153

155-
smtp.connect(SMTP_HOST, SMTP_PORT, DOMAIN_OR_IP, smtpCb, SSL_MODE);
154+
smtp.connect(SMTP_HOST, SMTP_PORT, smtpCb, SSL_MODE);
156155
if (!smtp.isConnected())
157156
return;
158157

examples/Sending/SendAsync/SendAsync.ino

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313

1414
#define SMTP_HOST "_______"
1515
#define SMTP_PORT 465 // SSL or 587 for STARTTLS
16-
#define DOMAIN_OR_IP "127.0.0.1"
1716
#define AUTHOR_EMAIL "_______"
1817
#define AUTHOR_PASSWORD "_______"
1918
#define RECIPIENT_EMAIL "_______"
@@ -110,7 +109,7 @@ void setup()
110109
// In case ESP8266 crashes, please see https://bit.ly/4iX1NkO
111110

112111
// Setting AWAIT_MODE parameter with false
113-
smtp.connect(SMTP_HOST, SMTP_PORT, DOMAIN_OR_IP, smtpCb, SSL_MODE, AWAIT_MODE);
112+
smtp.connect(SMTP_HOST, SMTP_PORT, smtpCb, SSL_MODE, AWAIT_MODE);
114113
}
115114

116115
void loop()

0 commit comments

Comments
 (0)