Mail output

@juaxix - That’s a deprecated class, just to let you know. You reminded me - I need to share my Obj-C classes. I’ll do that soon. Mine contains tweeting, FaceBook, and saving to the camera roll.
Thanks!

I would like to reanimate this thread to ask how I could attach a screenshot to Dave1707 's fantastic example. The first four lines should create the image, how can it be attached to the e-mail?

function setup()
    myScreenshot = image(WIDTH,HEIGHT)
    setContext(myScreenshot)
       sprite("Platformer Art:Guy Look Right",WIDTH/2,HEIGHT/2)
    setContext()
    
    
    to = "someone@email.com"
    bcc = "copy@email.com"
    subject = "This is the subject"

    str1="this is the first line"
    str2="\
   this is the second line"
    str3="\
   this is the third line"
    message=str1..str2..str3

    create(to, bcc, subject, message, myScreenshot)
end

function create(to, cc, subject, body)
    url = "mailto:"..to.."?bcc="..bcc.."&subject="..code1(subject).."&body="..code1(body)
    openURL(url)
end

function code1(str)  crlf = "%a%d-_.~"
    return string.gsub(str, "[^"..crlf.."]", code2)
end

function code2(c)
   return string.format ("%%%02X", string.byte(c))
end

@Surfer This is a simple mail format, and as far as I know, you can’t send an image. It’s just text.

Thanks @dave1707 , do you know if the image “myScreenshot” can be saved to the photoalbum then?

@Surfer Here’s an example of saving the image to the Dropbox folder. It can be synced with the Dropbox app and once it’s there, a lot of things can be done with it. For instance, it can be emailed to someone which is what I think you were trying to do with the above code.

function setup()
    myScreenshot = image(WIDTH,HEIGHT)
    setContext(myScreenshot)
    sprite("Platformer Art:Guy Look Right",WIDTH/2,HEIGHT/2)
    setContext()
    saveImage("Dropbox:Guy",myScreenshot)
end

function draw()
    background(0)
    sprite(myScreenshot,WIDTH/2,HEIGHT/2)    
end

Hi Dave!

This will be good for internal use but I would like the user of my app to be able to send me a screenshot. I’m afraid having her or him use dropbox assets is around one corner too much.

Could it be possible to trigger the original function of the ipad to do screenshots? That’s pressing the round button on front and small button on top together. The image goes directly to the photoalbum then.

Otherwise as a last option I will have to write the above instruction on screen and let the user do the screenshot manually.

Thanks so much!

@Surfer I don’t know right now if there’s a way for someone to email you a screen shot using Codea. For now the best way is to do a screen shot which goes to the photo library. From the photo library, the image can be emailed to you.