[SOLVED] Submit text form to email address

Thanks a LOT to Christopher Bishop, now the form works really really good. I post the code as sample code if anyone need it.

 local widget = require( "widget" ) local tHeight -- forward reference display.setDefault( "background", 80/255 ) ------------------------------------------- -- General event handler for fields ------------------------------------------- -- You could also assign different handlers for each textfield local function fieldHandler( textField ) return function( event ) if ( "began" == event.phase ) then -- This is the "keyboard has appeared" event -- In some cases you may want to adjust the interface when the keyboard appears. elseif ( "ended" == event.phase ) then -- This event is called when the user stops editing a field: for example, when they touch a different field elseif ( "editing" == event.phase ) then elseif ( "submitted" == event.phase ) then -- This event occurs when the user presses the "return" key (if available) on the onscreen keyboard print( textField().text ) -- Hide keyboard native.setKeyboardFocus( nil ) end end end display.setDefault( "anchorX", 0.0 ) -- default to TopLeft anchor point for new objects display.setDefault( "anchorY", 0.0 ) -- Note: currently this feature works in device builds or Xcode simulator builds only (also works on Corona Mac Simulator) local isAndroid = "Android" == system.getInfo("platformName") local inputFontSize = 18 local inputFontHeight = 30 tHeight = 30 if isAndroid then -- Android text fields have more chrome. It's either make them bigger, or make the font smaller. -- We'll do both inputFontSize = 14 inputFontHeight = 42 tHeight = 40 end subjectField = native.newTextField( 10, 210, 180, tHeight ) subjectField.font = native.newFont( native.systemFontBold, inputFontSize ) subjectField.inputType = "subject" subjectField:addEventListener( "userInput", fieldHandler( function() return emailField end ) ) group:insert(subjectField) messageField = native.newTextField( 10, 250, 180, 80 ) messageField.font = native.newFont( native.systemFontBold, inputFontSize ) messageField.inputType = "message" messageField:addEventListener( "userInput", fieldHandler( function() return passwordField end ) ) group:insert(messageField) ------------------------------------------- -- \*\*\* Add field labels \*\*\* ------------------------------------------- local lblSubject = display.newText( "Subject", 200, 210, native.systemFont, 18 ) lblSubject:setFillColor( 106, 106, 106 ) group:insert(lblSubject) local lblMessage = display.newText( "Message", 200, 250, native.systemFont, 18 ) lblMessage:setFillColor( 106, 106, 106 ) group:insert(lblMessage) --display.setDefault( "anchorX", 0.5 ) -- restore anchor points for new objects to center anchor point --display.setDefault( "anchorY", 0.5 ) ------------------------------------------- -- \*\*\* Create Buttons \*\*\* ------------------------------------------- -- "Send email" Button defaultButton = widget.newButton { defaultFile = "button.png", overFile = "buttonOver.png", labelColor = { default = { 1, 1, 1 }, }, fontSize = 18, emboss = true, onEvent = function(event) if (event.phase == "ended") then local options = { to = "info@yourdomain.it", -- insert here your email contact subject = subjectField.text, body = messageField.text, } native.showPopup("mail", options) end end, } group:insert(defaultButton) -- Position the buttons on screen defaultButton.x = 235 ; defaultButton.y = 370

This works great for 1 message field but how would you add multiple fields to the body?  Example:

body = textfield1.text + crlf + textfield2.text + crlf + textfield3.text,

Your help will be appreciated.

This works great for 1 message field but how would you add multiple fields to the body?  Example:

body = textfield1.text + crlf + textfield2.text + crlf + textfield3.text,

Your help will be appreciated.