TRB140 Email to Sms - Suggestion of modify for issue duplicate sms send

In the previous version of the script email_to_sms, we were using mbox:close() to terminate the POP3 connection after processing emails. However, this method only closes the connection without confirming any changes made during the session, such as marking emails for deletion.

This was causing an issue where emails that had been processed (and SMS sent) were not actually deleted from the mail server, leading to duplicate SMS messages being sent the next time the cron job executed. The emails remained on the server because mbox:close() doesn’t trigger the deletion of emails flagged with mbox:dele().

Solution:

To ensure that emails are correctly deleted after processing, I replaced mbox:close() with mbox:quit(). The mbox:quit() command not only closes the connection but also commits any changes made, such as deleting emails that have been flagged.

for i = cnt > MAX_MESSAGE_TO_READ and cnt - MAX_MESSAGE_TO_READ + 1 or 1, cnt do
handle_message(mbox, i)
end

mbox:quit() – Replaced mbox:close() with mbox:quit() to ensure email deletion

I suggest applying this modification in the future firmware, if possible.

Hello,

Thank you for your valuable suggestion regarding the email to SMS script and possible fix.

I communicated your suggestion to our Research and Development team for consideration and will inform you about their answer.

If you have any other suggestions or questions, feel free to leave them here.

Kind regards,

This topic was automatically closed after 15 days. New replies are no longer allowed.