@@ -194,12 +194,11 @@ uint16_t SendMail(char *buffer) {
194
194
195
195
#ifdef DEBUG_EMAIL_PORT
196
196
smtp->debug (true );
197
+ smtp->callback (smtpCallback);
197
198
#else
198
199
smtp->debug (false );
199
200
#endif
200
201
201
- // smtp->callback(smtpCallback);
202
-
203
202
SMTP_Message message;
204
203
email_mptr = &message;
205
204
message.clearRecipients ();
@@ -390,28 +389,40 @@ void send_message_txt(char *txt) {
390
389
/* Callback function to get the Email sending status */
391
390
void smtpCallback (SMTP_Status status) {
392
391
/* Print the current status */
393
- Serial.println (status.info ());
392
+ // Serial.println(status.info());
393
+ AddLog (LOG_LEVEL_INFO, PSTR (" MAI: %s" ),status.info ());
394
394
395
395
/* Print the sending result */
396
396
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");
401
405
struct tm dt;
402
406
403
407
for (size_t i = 0 ; i < smtp->sendingResult .size (); i++) {
404
408
/* Get the result item */
405
409
SMTP_Result result = smtp->sendingResult .getItem (i);
406
410
localtime_r ((time_t *)&result.timestamp , &dt);
407
411
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 ());
413
424
}
414
- Serial.println (" ----------------\n " );
425
+ // Serial.println("----------------\n");
415
426
}
416
427
}
417
428
0 commit comments