Corona SDK - 电子邮件不发送
Corona SDK - email doesn't send
我正在尝试使用 native.showPopup
发送电子邮件,但从未发送过电子邮件,下面是代码:
function scene:createScene( event )
function sendMail()
local options =
{
to = "yourname@youremail.com",
subject = "Game Result",
isBodyHtml = true,
body = "<html><body>Play Time: <b>10</b> <br> Score: <b>1</b></body></html>"
}
native.showPopup("mail", options)
end
-- add some button to send mail
submitBtn = widget.newButton{
defaultFile="assets/submit.png",
over="assets/submit.png",
width=display.contentWidth/2, height=display.contentHeight/6,
onPress = sendMail
}
end
scene:addEventListener( "createScene", scene )
return scene
这是 build.settings:
settings = {
android =
{
versionCode = "11",
usesPermissions =
{
"android.permission.INTERNET",
"android.permission.WRITE_EXTERNAL_STORAGE",
"android.permission.ACCESS_FINE_LOCATION",
"android.permission.ACCESS_COARSE_LOCATION",
}
},
}
我已经在模拟器和手机上尝试过,但没有任何效果。谁能帮帮我?
我不知道为什么,但我只是添加了一些验证,现在它的工作..
这是我所做的修订代码:
function sendMail()
local options =
{
to = "yourname@youremail.com",
subject = "Game Result",
isBodyHtml = true,
body = "<html><body>Play Time: <b>10</b> <br> Score: <b>1</b></body></html>"
}
-- add some validation
-- and this is revision code
local mailSend = native.showPopup("mail", options)
if not mailSend then
native.showAlert( "Alert!", "Mail cannot be send.", { "OK" })
end
end
感谢
我正在尝试使用 native.showPopup
发送电子邮件,但从未发送过电子邮件,下面是代码:
function scene:createScene( event )
function sendMail()
local options =
{
to = "yourname@youremail.com",
subject = "Game Result",
isBodyHtml = true,
body = "<html><body>Play Time: <b>10</b> <br> Score: <b>1</b></body></html>"
}
native.showPopup("mail", options)
end
-- add some button to send mail
submitBtn = widget.newButton{
defaultFile="assets/submit.png",
over="assets/submit.png",
width=display.contentWidth/2, height=display.contentHeight/6,
onPress = sendMail
}
end
scene:addEventListener( "createScene", scene )
return scene
这是 build.settings:
settings = {
android =
{
versionCode = "11",
usesPermissions =
{
"android.permission.INTERNET",
"android.permission.WRITE_EXTERNAL_STORAGE",
"android.permission.ACCESS_FINE_LOCATION",
"android.permission.ACCESS_COARSE_LOCATION",
}
},
}
我已经在模拟器和手机上尝试过,但没有任何效果。谁能帮帮我?
我不知道为什么,但我只是添加了一些验证,现在它的工作.. 这是我所做的修订代码:
function sendMail()
local options =
{
to = "yourname@youremail.com",
subject = "Game Result",
isBodyHtml = true,
body = "<html><body>Play Time: <b>10</b> <br> Score: <b>1</b></body></html>"
}
-- add some validation
-- and this is revision code
local mailSend = native.showPopup("mail", options)
if not mailSend then
native.showAlert( "Alert!", "Mail cannot be send.", { "OK" })
end
end
感谢