Form problem

Hello. I’ve included questions and answers in my app. How can I make sure that once I press the send button the replies are sent to me on the email or maybe in a file. Thank you

local composer = require(“composer”)
local scene = composer.newScene()

local widget = require(“widget”)

function scene:create(event)
local sceneGroup = self.view

local scrollView = widget.newScrollView({
    top = -130,
    left = 0,
    width = display.contentWidth,
    height = display.contentHeight + 2700,
    scrollWidth = display.contentWidth,
    scrollHeight = display.contentHeight,
    horizontalScrollDisabled = true,
    backgroundColor = {0, 0, 255}
})

local rispostaUtente = ""

local function onRadioPress(event)
    local target = event.target
    if target.id == "si" then
        rispostaUtente = "Si"
    elseif target.id == "no" then
        rispostaUtente = "No"
    end
end

local function inviaButtonPress(event)
    if event.phase == "ended" then
        local options = {
            to = "calciu.andrei@yahoo.com",
            subject = "VARFORM",
            body = "La risposta dell'utente è: " .. rispostaUtente
        }
        native.showPopup("mail", options)
    end
end

local radioGroup = display.newGroup()

local radioButtonSi = widget.newSwitch(
    {
        left = 50,
        top = 100,
        style = "radio",
        id = "si",
        onPress = onRadioPress
    }
)
radioGroup:insert(radioButtonSi)

local radioButtonNo = widget.newSwitch(
    {
        left = 150,
        top = 100,
        style = "radio",
        id = "no",
        onPress = onRadioPress
    }
)
radioGroup:insert(radioButtonNo)

local labelSi = display.newText(
    {
        text = "SI",
        x = radioButtonSi.x + radioButtonSi.width + 10,
        y = radioButtonSi.y,
        fontSize = 16
    }
)

local labelNo = display.newText(
    {
        text = "NO",
        x = radioButtonNo.x + radioButtonNo.width + 10,
        y = radioButtonNo.y,
        fontSize = 16
    }
)

local domanda = display.newText(
    {
        text = "La tua risposta:",
        x = display.contentCenterX,
        y = 50,
        fontSize = 20
    }
)

local inviaButton = widget.newButton(
    {
        label = "Invia",
        emboss = false,
        shape = "roundedRect",
        width = 100,
        height = 40,
        cornerRadius = 8,
        fillColor = {default = {0.5, 0.5, 1}, over = {0.7, 0.7, 1}},
        labelColor = {default = {1, 1, 1}, over = {0.5, 0.5, 0.5}},
        onEvent = inviaButtonPress
    }
)
inviaButton.x = display.contentCenterX
inviaButton.y = 200

local group = display.newGroup()
scrollView:insert(radioGroup)
scrollView:insert(labelSi)
scrollView:insert(labelNo)
scrollView:insert(domanda)
scrollView:insert(inviaButton)

sceneGroup:insert(scrollView)

end

scene:addEventListener(“create”, scene)

return scene

Solar2D doesn’t provide a listener for the event, but you should be able to tell if the user opened the popup via showPopup as it returns true or false depending on whether the popup was shown or not.

The user will be able to tell if they managed to send the mail via their mail app of choice since Solar2D doesn’t handle the emails anyway.