Skip to content

Commit aad917d

Browse files
authored
Email32 more debug (arendst#21010)
* more debug on esp32 mail * Update xdrv_01_2_webserver_esp32_mail.ino
1 parent 3c70e63 commit aad917d

File tree

1 file changed

+24
-13
lines changed

1 file changed

+24
-13
lines changed

tasmota/tasmota_xdrv_driver/xdrv_01_2_webserver_esp32_mail.ino

+24-13
Original file line numberDiff line numberDiff line change
@@ -194,12 +194,11 @@ uint16_t SendMail(char *buffer) {
194194

195195
#ifdef DEBUG_EMAIL_PORT
196196
smtp->debug(true);
197+
smtp->callback(smtpCallback);
197198
#else
198199
smtp->debug(false);
199200
#endif
200201

201-
// smtp->callback(smtpCallback);
202-
203202
SMTP_Message message;
204203
email_mptr = &message;
205204
message.clearRecipients();
@@ -390,28 +389,40 @@ void send_message_txt(char *txt) {
390389
/* Callback function to get the Email sending status */
391390
void smtpCallback(SMTP_Status status) {
392391
/* Print the current status */
393-
Serial.println(status.info());
392+
//Serial.println(status.info());
393+
AddLog(LOG_LEVEL_INFO, PSTR("MAI: %s"),status.info());
394394

395395
/* Print the sending result */
396396
if (status.success()) {
397-
Serial.println("----------------");
398-
Serial.printf("Message sent success: %d\n", status.completedCount());
399-
Serial.printf("Message sent failled: %d\n", status.failedCount());
400-
Serial.println("----------------\n");
397+
//Serial.println("----------------");
398+
//Serial.printf("Message sent success: %d\n", status.completedCount());
399+
AddLog(LOG_LEVEL_INFO, PSTR("MAI: Message sent success: %d"),status.completedCount());
400+
401+
//Serial.printf("Message sent failled: %d\n", status.failedCount());
402+
AddLog(LOG_LEVEL_INFO, PSTR("MAI: Message sent failed: %d"),status.failedCount());
403+
404+
//Serial.println("----------------\n");
401405
struct tm dt;
402406

403407
for (size_t i = 0; i < smtp->sendingResult.size(); i++) {
404408
/* Get the result item */
405409
SMTP_Result result = smtp->sendingResult.getItem(i);
406410
localtime_r((time_t*)&result.timestamp, &dt);
407411

408-
Serial.printf("Message No: %d\n", i + 1);
409-
Serial.printf("Status: %s\n", result.completed ? "success" : "failed");
410-
Serial.printf("Date/Time: %d/%d/%d %d:%d:%d\n", dt.tm_year + 1900, dt.tm_mon + 1, dt.tm_mday, dt.tm_hour, dt.tm_min, dt.tm_sec);
411-
Serial.printf("Recipient: %s\n", result.recipients);
412-
Serial.printf("Subject: %s\n", result.subject);
412+
//Serial.printf("Message No: %d\n", i + 1);
413+
AddLog(LOG_LEVEL_INFO, PSTR("MAI: Message No: %d"),i + 1);
414+
415+
//Serial.printf("Status: %s\n", result.completed ? "success" : "failed");
416+
AddLog(LOG_LEVEL_INFO, PSTR("MAI: Status: %s"),result.completed ? "success" : "failed");
417+
418+
//Serial.printf("Date/Time: %d/%d/%d %d:%d:%d\n", dt.tm_year + 1900, dt.tm_mon + 1, dt.tm_mday, dt.tm_hour, dt.tm_min, dt.tm_sec);
419+
AddLog(LOG_LEVEL_INFO, PSTR("MAI: Date/Time: %d/%d/%d %d:%d:%d"), dt.tm_year + 1900, dt.tm_mon + 1, dt.tm_mday, dt.tm_hour, dt.tm_min, dt.tm_sec);
420+
//Serial.printf("Recipient: %s\n", result.recipients);
421+
AddLog(LOG_LEVEL_INFO, PSTR("MAI: Recipient: %s"),result.recipients.c_str());
422+
//Serial.printf("Subject: %s\n", result.subject);
423+
AddLog(LOG_LEVEL_INFO, PSTR("MAI: Subject: %s"),result.subject.c_str());
413424
}
414-
Serial.println("----------------\n");
425+
//Serial.println("----------------\n");
415426
}
416427
}
417428

0 commit comments

Comments
 (0)