1

Corona lua: システム ディレクトリに保存されているデータ ファイルをメールに添付するにはどうすればよいですか? ビルド後、iPad の電子メール ポップアップに data.txt ファイルの画像が表示されますが、電子メールが送信されても​​添付されません。画像はうまくいきます。MIME タイプとして「text」、「plain」、「text/plain」を使用しました。これでお役に立てれば幸いです。

4

1 に答える 1

1

これを試して:

-----------------------------------------------------------------------------------
                     -- Creating the text file --
-----------------------------------------------------------------------------------
local filePath_Type = system.pathForFile( "myTextFile.txt", system.DocumentsDirectory )
local file = io.open( filePath_Type, "r" )
if file then
  io.close( file )
else
  --Create an empty file--  
  local path_Type = system.pathForFile( "myTextFile.txt", system.DocumentsDirectory )
  local file = io.open( path_Type, "w+b" )
  file:write("My data inside file")
  io.close( file )
end

-----------------------------------------------------------------------------------
                      -- Now, to email this file --
-----------------------------------------------------------------------------------
function showMailPicker()
  -- Create mail options --
  local options =
    {
      to = { "me@me.com",},
      subject = "Subject Text",
      body = "Email Body",
      attachment =
        {
          { baseDir=system.DocumentsDirectory, filename="myTextFile.txt", type="text" },
        },
  }
   -- Send mail --
  native.showPopup("mail", options)
end

submitButton = display.newImageRect("myButton.png",100,40)
submitButton.x = 160
submitButton.y = 240
submitButton:addEventListener("tap",showMailPicker)

コーディングを続ける.............. :)

于 2013-08-23T05:23:28.207 に答える