I’ve got my application sending emails via smtp, but it blocks: input, stops animations, and prevents or queues other UI calls on the application until the smtp call is complete.
Is there any way to do the send operation asynchronously? I would like the user to be able to do other operations in the application while waiting for smtp to complete.
Here is some example code, where I create a spinner widget and it becomes frozen during the smtp call.
I’ve tested this on the simulator (build 2016.2828) and my android device (sgs3).
local smtp = require("socket.smtp") local widget = require("widget") local spinner = widget.newSpinner({x=display.contentCenterX, y=display.contentCenterY}) spinner:start() local r, e = smtp.send({ from = "\<my@email.com\>", rcpt = {"\<recipient@email.com\>", source = smtp.message(messageTable), user = me, password = passWord, server = serverHostName, port = 25 }) print(r, e)
Thanks,
Daniel