Emailing an attachment
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller
-
- Posts: 151
- Joined: Sat Aug 25, 2012 1:14 am
Emailing an attachment
Hello,
I noticed the the latest release indicated that the bug had been fixed for the email attachment error. I tried this code and while I can see the attachment prior to sending it does not send the attachment.
on mouseup
mobileSetKeyboardType "email"
Ask "Send to what email address?"
put it into tAddress
set the itemdel to tab
if it = empty then
exit to top
end if
put specialFolderPath("engine") & "/Compost.pdf" into tFilePath
answer tFilePath
put tFilePath into tAttachment["file"]
put tURL & ".pdf" into tAttachment["name"]
put "application/pdf" into tAttachment["type"]
put "Hello, Here's an attachment about Compost:" after tText
set itemdel to tab
if the environment is "mobile" then
mobileComposeMail "Compost" & tURL, tAddress,,, tText, tAttachment
else
Revmail tAddress, , "Get WSU Master Gardener Fact Sheets at:", tText
end if
end mouseup
Thank you
Ty
I noticed the the latest release indicated that the bug had been fixed for the email attachment error. I tried this code and while I can see the attachment prior to sending it does not send the attachment.
on mouseup
mobileSetKeyboardType "email"
Ask "Send to what email address?"
put it into tAddress
set the itemdel to tab
if it = empty then
exit to top
end if
put specialFolderPath("engine") & "/Compost.pdf" into tFilePath
answer tFilePath
put tFilePath into tAttachment["file"]
put tURL & ".pdf" into tAttachment["name"]
put "application/pdf" into tAttachment["type"]
put "Hello, Here's an attachment about Compost:" after tText
set itemdel to tab
if the environment is "mobile" then
mobileComposeMail "Compost" & tURL, tAddress,,, tText, tAttachment
else
Revmail tAddress, , "Get WSU Master Gardener Fact Sheets at:", tText
end if
end mouseup
Thank you
Ty
Re: Emailing an attachment
Hi Ty,
quick shot:
...
put tURL & ".pdf" into tAttachment["name"]
...
tURL has not been filled with content so far!
Best
Klaus
quick shot:
...
put tURL & ".pdf" into tAttachment["name"]
...
tURL has not been filled with content so far!
Best
Klaus
-
- Posts: 151
- Joined: Sat Aug 25, 2012 1:14 am
Re: Emailing an attachment
Thank you Klaus, but I've got to ask again, because I'm just not getting it.
I want to export and email a screen shot.
mobileSetKeyboardType "email"
set the defaultFolder to specialFolderPath("documents")
export snapshot from this card to URL ("file:" & specialFolderPath("documents") & "/Color.jpg") as JPEG
local tSubject, tTo, tCCs, tBCCs, tBody, tAttachment
put empty into lvLaunchString
put specialFolderPath("documents") & "/Color.jpg" into tFilePath
put tFilePath into tAttachment["path"]
put "color.jpg" into tAttachment["file"]
put "MyColor.jpg" into tAttachment["name"]
put "image/jpg" into tAttachment["type"]
mobileComposeMail tSubject, tTo, tCCs, tBCCs, tBody, tAttachment
I've tried putting tFilePath into the tAttachment["file"]
I know it is simple, but I can't see it.
Thank you for your help
Ty
I want to export and email a screen shot.
mobileSetKeyboardType "email"
set the defaultFolder to specialFolderPath("documents")
export snapshot from this card to URL ("file:" & specialFolderPath("documents") & "/Color.jpg") as JPEG
local tSubject, tTo, tCCs, tBCCs, tBody, tAttachment
put empty into lvLaunchString
put specialFolderPath("documents") & "/Color.jpg" into tFilePath
put tFilePath into tAttachment["path"]
put "color.jpg" into tAttachment["file"]
put "MyColor.jpg" into tAttachment["name"]
put "image/jpg" into tAttachment["type"]
mobileComposeMail tSubject, tTo, tCCs, tBCCs, tBody, tAttachment
I've tried putting tFilePath into the tAttachment["file"]
I know it is simple, but I can't see it.
Thank you for your help
Ty
Re: Emailing an attachment
HI Ty,
hmmm, looks definitivel correct! Is this with LC 6.6 DP1?
You could "answer the result" after the composemail command,
but that will only return "unknown" on error on Android.
Best
Klaus
hmmm, looks definitivel correct! Is this with LC 6.6 DP1?
You could "answer the result" after the composemail command,
but that will only return "unknown" on error on Android.
Best
Klaus
-
- Posts: 151
- Joined: Sat Aug 25, 2012 1:14 am
Re: Emailing an attachment
It is with 6.6.0-dp|build
Should I file a bug report?
Should I file a bug report?
Re: Emailing an attachment
Hi Ty,
no wait, I think I got it
..
put specialFolderPath("documents") & "/Color.jpg" into tFilePath
## Invalid key for attachment -> path!
## put tFilePath into tAttachment["path"]
## Need an absolute pathname here:
## put "color.jpg" into tAttachment["file"]
## This should do the trick:
put tFilePath into tAttachment["file"]
put "MyColor.jpg" into tAttachment["name"]
put "image/jpg" into tAttachment["type"]
mobileComposeMail tSubject, tTo, tCCs, tBCCs, tBody, tAttachment
...
Best
Klaus
no wait, I think I got it
..
put specialFolderPath("documents") & "/Color.jpg" into tFilePath
## Invalid key for attachment -> path!
## put tFilePath into tAttachment["path"]
## Need an absolute pathname here:
## put "color.jpg" into tAttachment["file"]
## This should do the trick:
put tFilePath into tAttachment["file"]
put "MyColor.jpg" into tAttachment["name"]
put "image/jpg" into tAttachment["type"]
mobileComposeMail tSubject, tTo, tCCs, tBCCs, tBody, tAttachment
...
Best
Klaus
-
- Posts: 151
- Joined: Sat Aug 25, 2012 1:14 am
Re: Emailing an attachment
Still didn't work:
mobileSetKeyboardType "email"
local tSubject, tTo, tCCs, tBCCs, tBody, tAttachment
put empty into lvLaunchString
set the defaultFolder to specialFolderPath("documents")
export snapshot from this card to URL ("file:" & specialFolderPath("documents") & "/Color.jpg") as JPEG
put specialFolderPath("documents") & "/Color.jpg" into tFilePath
put tFilePath into tAttachment["file"]
put "MyColor.jpg" into tAttachment["name"]
put "image/jpg" into tAttachment["type"]
mobileComposeMail tSubject, tTo, tCCs, tBCCs, tBody, tAttachment
mobileSetKeyboardType "email"
local tSubject, tTo, tCCs, tBCCs, tBody, tAttachment
put empty into lvLaunchString
set the defaultFolder to specialFolderPath("documents")
export snapshot from this card to URL ("file:" & specialFolderPath("documents") & "/Color.jpg") as JPEG
put specialFolderPath("documents") & "/Color.jpg" into tFilePath
put tFilePath into tAttachment["file"]
put "MyColor.jpg" into tAttachment["name"]
put "image/jpg" into tAttachment["type"]
mobileComposeMail tSubject, tTo, tCCs, tBCCs, tBody, tAttachment
Re: Emailing an attachment
Hi Ty,
aha!
Try this:
Best
Klaus
aha!
Try this:
Code: Select all
...
put the windowID of this stack into tWinID
export snapshot from rect (the rect of this card) of window tWinID to FILE (specialFolderPath("documents") & "/Color.jpg") as JPEG
## Alway good to check THE RESULT after these kind of operations!
if the result <> empty then
answer "ERROR:" && the result
exit to top
end if
...
Klaus
-
- Posts: 151
- Joined: Sat Aug 25, 2012 1:14 am
Re: Emailing an attachment
Thanks Klaus,
But it is stopping at the export snapshot line.
Ty
But it is stopping at the export snapshot line.
Ty
Re: Emailing an attachment
Hi Ty,
oh, sorry, old desktop habits, "windowID" is not supported on mobile!
This should do the trick:
...
## put the windowID of this stack into tWinID
export snapshot from rect (the rect of this card) to FILE (specialFolderPath("documents") & "/Color.jpg") as JPEG
...
Best
Klaus
oh, sorry, old desktop habits, "windowID" is not supported on mobile!
This should do the trick:
...
## put the windowID of this stack into tWinID
export snapshot from rect (the rect of this card) to FILE (specialFolderPath("documents") & "/Color.jpg") as JPEG
...
Best
Klaus
-
- VIP Livecode Opensource Backer
- Posts: 3901
- Joined: Sat Mar 24, 2007 2:54 am
- Location: Palo Alto
Re: Emailing an attachment
I finally got around to testing this.
Big trick; Disconnect your phone from the computer. Seems the sd card is used during this process and cannot be accessed while connected.
Worked with gMail.
You can skip the rest:
All three methods worked.
liveCode 6.6.0 dp1, Android 2.3.5
Simon
Big trick; Disconnect your phone from the computer. Seems the sd card is used during this process and cannot be accessed while connected.
Worked with gMail.
You can skip the rest:
Code: Select all
on mouseUp
put image 1 into tAttachment["data"]
put "image/gif" into tAttachment["type"]
put "my picture" into tAttachment["name"]
mobileComposeMail "Image Example", "you@youMailHost.com",,,, tAttachment
end mouseUp
on mouseUp
set the vis of the templateImage to false
mobilePickPhoto "camera"
put the last image into tAttachment["data"]
put "image/jpeg" into tAttachment["type"]
put "cam picture" into tAttachment["name"]
mobileComposeMail "Camera Example", "you@youMailHost.com",,,, tAttachment
end mouseUp
on mouseUp
put url("binfile:" &specialFolderPath("engine") & "/LOGO.png") into tFile
put tFile into tAttachment["data"]
put "image/png" into tAttachment["type"]
put "file picture" into tAttachment["name"]
mobileComposeMail "File Example", "you@youMailHost.com",,,, tAttachment
end mouseUp
liveCode 6.6.0 dp1, Android 2.3.5
Simon
I used to be a newbie but then I learned how to spell teh correctly and now I'm a noob!
-
- Posts: 151
- Joined: Sat Aug 25, 2012 1:14 am
Re: Emailing an attachment
I am trying this but to no avail there still isn't an attchment.:
My phone is over the internet so I test it on the android devise not connect to the computer. I'm sure it is right in front of me, but I can't see it.
mobileSetKeyboardType "email"
local tSubject, tTo, tCCs, tBCCs, tBody, tAttachment
put empty into lvLaunchString
set the defaultFolder to specialFolderPath("documents")
export snapshot from rect "0,0,200,200" of this card to FILE (specialFolderPath("documents") & "/Color.jpg") as JPEG
if the result <> empty then
answer "ERROR:" && the result
exit to top
end if
put url("binfile:" &specialFolderPath("documents") & "/color.jpg") into tFile
## I've also tried without the binfile as in a previous example.
put tFile into tAttachment["data"]
put "image/jpg" into tAttachment["type"]
put "file picture" into tAttachment["name"]
mobileComposeMail "File Example", "tyarmstead@comcast.net",,,, tAttachment
Thanks guys, I really appreciate all of your help.
Ty
My phone is over the internet so I test it on the android devise not connect to the computer. I'm sure it is right in front of me, but I can't see it.
mobileSetKeyboardType "email"
local tSubject, tTo, tCCs, tBCCs, tBody, tAttachment
put empty into lvLaunchString
set the defaultFolder to specialFolderPath("documents")
export snapshot from rect "0,0,200,200" of this card to FILE (specialFolderPath("documents") & "/Color.jpg") as JPEG
if the result <> empty then
answer "ERROR:" && the result
exit to top
end if
put url("binfile:" &specialFolderPath("documents") & "/color.jpg") into tFile
## I've also tried without the binfile as in a previous example.
put tFile into tAttachment["data"]
put "image/jpg" into tAttachment["type"]
put "file picture" into tAttachment["name"]
mobileComposeMail "File Example", "tyarmstead@comcast.net",,,, tAttachment
Thanks guys, I really appreciate all of your help.
Ty
Re: Emailing an attachment
Hi Ty,
not sure, but isn't the Android OS case sensitive like iOS?
If yes:
...
## put url("binfile:" &specialFolderPath("documents") & "/color.jpg") into tFile
put url("binfile:" &specialFolderPath("documents") & "/Color.jpg") into tFile
..
Best
Klaus
not sure, but isn't the Android OS case sensitive like iOS?
If yes:
...
## put url("binfile:" &specialFolderPath("documents") & "/color.jpg") into tFile
put url("binfile:" &specialFolderPath("documents") & "/Color.jpg") into tFile
..
Best
Klaus
-
- VIP Livecode Opensource Backer
- Posts: 3901
- Joined: Sat Mar 24, 2007 2:54 am
- Location: Palo Alto
Re: Emailing an attachment
I'm not sure how sensitive Android is but
put "image/jpg" into tAttachment["type"]
put "image/jpeg" into tAttachment["type"]
I did use image/jpg but the attachment came in as .dat so there is something going on. image/jpeg came in with .jpg
Simon
put "image/jpg" into tAttachment["type"]
put "image/jpeg" into tAttachment["type"]
I did use image/jpg but the attachment came in as .dat so there is something going on. image/jpeg came in with .jpg
Simon
I used to be a newbie but then I learned how to spell teh correctly and now I'm a noob!
-
- Posts: 151
- Joined: Sat Aug 25, 2012 1:14 am
Re: Emailing an attachment
This works for Gmail but not Comcast:
ocal tSubject, tTo, tCCs, tBCCs, tBody, tAttachment
put empty into lvLaunchString
set the defaultFolder to specialFolderPath("documents")
export snapshot from rect "0,0,200,200" of this card to FILE (specialFolderPath("documents") & "/Color.jpg") as JPEG
if the result <> empty then
answer "ERROR:" && the result
exit to top
end if
put specialFolderPath("documents") & "/Color.jpg" into tFile
put tFile into tAttachment["file"]
put "image/jpeg" into tAttachment["type"]
put "My Colors" into tAttachment["name"]
mobileComposeMail "My Color Selections", "tyarmstead@comcast.net",,,, tAttachment
Thank you Klaus and Simon for all o f your help. Do you think I am doing something wrong as to why it won't work with comast.net email?
Thank you again
Ty
ocal tSubject, tTo, tCCs, tBCCs, tBody, tAttachment
put empty into lvLaunchString
set the defaultFolder to specialFolderPath("documents")
export snapshot from rect "0,0,200,200" of this card to FILE (specialFolderPath("documents") & "/Color.jpg") as JPEG
if the result <> empty then
answer "ERROR:" && the result
exit to top
end if
put specialFolderPath("documents") & "/Color.jpg" into tFile
put tFile into tAttachment["file"]
put "image/jpeg" into tAttachment["type"]
put "My Colors" into tAttachment["name"]
mobileComposeMail "My Color Selections", "tyarmstead@comcast.net",,,, tAttachment
Thank you Klaus and Simon for all o f your help. Do you think I am doing something wrong as to why it won't work with comast.net email?
Thank you again
Ty