2014년 11월 29일 토요일

Creating e-mail body and subject in the app

I am creating an app in which i have taken two textboxes and one button.I want that when the button is pressed the text in first textbox becomes the subject of an e-mail and the text in second textbox becomes the body of the mail with the e-mail destination mentioned in the blocks section.Please i would be glad if i get the block code demo of my problem.Thank you all.



How to send an eMail

Advice: Before posting, it's a good idea to search in this forum. Many others have likely run into problems similar to yours. How to search see screenshot.



What you want to do is accomplished using the ActivityStarter and is explained here:  http://ai2.appinventor.mit.edu/reference/other/activitystarter.html  

Start the mailer with pre-addressed message

To start the Android mailer application, use the action android.intent.action.VIEW . You can use Activity starter's DataUri property to specify the recipient, the subject, and the body of the message. In each case, starting the activity will bring up the Android mailer, and you can complete the message and then press "Send".
For example, if you specify:
Action: android.intent.action.VIEW 
DataUri: mailto:santa@northpole.com
then starting the activity will bring up the mailer, with the addressee filed in.
If you specify:
Action: android.intent.action.VIEW 
DataUri: mailto:santa@northpole.com?subject=Please Santa&body=Bring me a pony.
then starting the activity will bring up the mailer, with the addressee, the subject, and the body filled in. You can use the mailer to edit these before sending the message, if you prefer.
The DataURI here must be a URL encoded message designed to work with the internet mailto service. Search the Web to find appropriate documentation and tools for creating these, for example Elements of a Mailto: URL
Try some blocks, post a screen capture of your blocks if you run into issues and want more specific advice.


i want to create contents of mail in textboxes rather than in lock section,to make app more flexible......

You need two more join puzzle pieces.      Try your blocks again after correcting.

???
have you seen this link?



thank you so much.It worked.Thanks a lot


댓글 없음:

댓글 쓰기