-
In trying to modify the "Sent_Text" code example for repeated calling, I'm having trouble properly restarting the session. I moved the sendMail code from setup() to a function called mailSend() and call that repeatedly from within loop(). But it appears that that I'm not properly reopening the session. If I begin malSend() with SMTPSession smtp;, then the mail results reporting looks like this: 20:43:34.100 -> If I omit the SMTPSession smtp;, then I get a different extreme: 20:46:26.539 -> ---------------- The above sending result is after sending three times (three calls to mailSend(). Note that the Recipient and Subject are garbage for all previous sends, and that only one email is sent per call. Does another code example give a better clue on how to structure SMTP for more than one send? |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 6 replies
-
This is already comment. ESP-Mail-Client/examples/SMTP/Send_Text/Send_Text.ino Lines 236 to 237 in 633c98a SMTPSession MUST be defined in global as it used widely. |
Beta Was this translation helpful? Give feedback.
-
To log in, just call smtp.connect(&session); Where session variable is the ESP_Mail_Session which hold the log in credentials. |
Beta Was this translation helpful? Give feedback.
-
The ESP_Mail_Session and SMTP_Message can be define locally in the usage scope unless the garbage appeared in smtp.sendingResult that used the string from SMTP_Message that cannot access outside it defined scope. |
Beta Was this translation helpful? Give feedback.
This is already comment.
ESP-Mail-Client/examples/SMTP/Send_Text/Send_Text.ino
Lines 236 to 237 in 633c98a
SMTPSession MUST be defined in global as it used widely.