Created
December 19, 2013 14:34
-
-
Save adumont/8040008 to your computer and use it in GitHub Desktop.
Send an (text) email to [email protected] via Gmail from command line [root]
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This will send an (text) email to [email protected] by calling a Gmail activity. Root is needed. | |
root# am start -a android.intent.action.SEND -t "text/plain" -c android.intent.category.DEFAULT -e to [email protected] -e android.intent.extra.SUBJECT Test -e android.intent.extra.TEXT "body" -n com.google.android.gm/.AutoSendActivity com.google.android.gm | |
- Send an attachement: --> see at the end (Not working at the moment) -e android.intent.extra.STREAM /sdcard/map.png | |
More info: | |
Action: android.intent.action.SEND | |
Extra: to:%email | |
Extra: android.intent.extra.SUBJECT:%subject | |
Extra: android.intent.extra.TEXT:%body | |
Package: com.google.android.gm | |
Class: com.google.android.gm.AutoSendActivity | |
Target: Activity | |
usage: am start [-D] [-W] [-P <FILE>] [--start-profiler <FILE>] | |
[--R COUNT] [-S] [--opengl-trace] | |
[--user <USER_ID> | current] <INTENT> | |
<INTENT> specifications include these flags and arguments: | |
[-a <ACTION>] [-d <DATA_URI>] [-t <MIME_TYPE>] | |
[-c <CATEGORY> [-c <CATEGORY>] ...] | |
[-e|--es <EXTRA_KEY> <EXTRA_STRING_VALUE> ...] | |
[--esn <EXTRA_KEY> ...] | |
[--ez <EXTRA_KEY> <EXTRA_BOOLEAN_VALUE> ...] | |
[--ei <EXTRA_KEY> <EXTRA_INT_VALUE> ...] | |
[--el <EXTRA_KEY> <EXTRA_LONG_VALUE> ...] | |
[--ef <EXTRA_KEY> <EXTRA_FLOAT_VALUE> ...] | |
[--eu <EXTRA_KEY> <EXTRA_URI_VALUE> ...] | |
[--ecn <EXTRA_KEY> <EXTRA_COMPONENT_NAME_VALUE>] | |
[--eia <EXTRA_KEY> <EXTRA_INT_VALUE>[,<EXTRA_INT_VALUE...]] | |
[--ela <EXTRA_KEY> <EXTRA_LONG_VALUE>[,<EXTRA_LONG_VALUE...]] | |
[--efa <EXTRA_KEY> <EXTRA_FLOAT_VALUE>[,<EXTRA_FLOAT_VALUE...]] | |
[-n <COMPONENT>] [-f <FLAGS>] | |
[--grant-read-uri-permission] [--grant-write-uri-permission] | |
[--debug-log-resolution] [--exclude-stopped-packages] | |
[--include-stopped-packages] | |
[--activity-brought-to-front] [--activity-clear-top] | |
[--activity-clear-when-task-reset] [--activity-exclude-from-recents] | |
[--activity-launched-from-history] [--activity-multiple-task] | |
[--activity-no-animation] [--activity-no-history] | |
[--activity-no-user-action] [--activity-previous-is-top] | |
[--activity-reorder-to-front] [--activity-reset-task-if-needed] | |
[--activity-single-top] [--activity-clear-task] | |
[--activity-task-on-home] | |
[--receiver-registered-only] [--receiver-replace-pending] | |
[--selector] | |
[<URI> | <PACKAGE> | <COMPONENT>] | |
Action: android.intent.action.SEND | |
Extra: to:%email | |
Extra: android.intent.extra.SUBJECT:%subject | |
Extra: android.intent.extra.TEXT:%body | |
Package: com.google.android.gm | |
Class: com.google.android.gm.AutoSendActivity | |
Target: Activity? | |
{ | |
"id":"SEND_EMAIL", | |
"mimetype":"text\/plain", | |
"name":"Send Email", | |
"appname":"Gmail", | |
"package":"com.google.android.gm", | |
"target":"Activity", | |
"action":"android.intent.action.SEND", | |
"class":"com.google.android.gm.AutoSendActivity", | |
"categories":[ | |
{ | |
"category":"android.intent.category.DEFAULT", | |
"name":"android.intent.category.DEFAULT" | |
} | |
], | |
"hasOutput":false, | |
"extras":[ | |
{ | |
"isOutput":false, | |
"type":"String", | |
"description":"Email recipient", | |
"key":"to", | |
"name":"To" | |
}, | |
{ | |
"isOutput":false, | |
"type":"String", | |
"description":"Subject of the Email", | |
"key":"android.intent.extra.SUBJECT", | |
"name":"Subject" | |
}, | |
{ | |
"isOutput":false, | |
"type":"String", | |
"description":"Body of the Email", | |
"key":"android.intent.extra.TEXT", | |
"name":"Text" | |
}, | |
{ | |
"isOutput":false, | |
"type":"Uri", | |
"description":"File or comma separated files to attach to the Email", | |
"key":"android.intent.extra.STREAM", | |
"name":"Attachments" | |
} | |
] | |
} | |
Send an attachement: (Not working at the moment) | |
am start -a android.intent.action.SEND -t "text/plain" -c android.intent.category.DEFAULT -e to [email protected] -e android.intent.extra.SUBJECT Test -e android.intent.extra.TEXT "body" -e android.intent.extra.STREAM /sdcard/map.png -n com.google.android.gm/.AutoSendActivity com.google.android.gm | |
D/AndroidRuntime(5287): Calling main entry com.android.commands.am.Am | |
I/ActivityManager(496): START u0 {act=android.intent.action.SEND cat=[android.intent.category.DEFAULT] typ=text/plain flg=0x10000000 pkg=com.google.android.gm cmp=com.google.android.gm/.AutoSendActivity (has extras)} from pid 5287 | |
D/AndroidRuntime(5287): Shutting down VM | |
W/Bundle (5119): Key android.intent.extra.STREAM expected Parcelable but value was a java.lang.String. The default value <null> was returned. | |
W/Bundle (5119): Attempt to cast generated internal exception: | |
W/Bundle (5119): java.lang.ClassCastException: java.lang.String cannot be cast to android.os.Parcelable | |
W/Bundle (5119): at android.os.Bundle.getParcelable(Bundle.java:1212) | |
W/Bundle (5119): at com.android.mail.compose.ComposeActivity.a(SourceFile:664) | |
W/Bundle (5119): at com.android.mail.compose.ComposeActivity.zR(SourceFile:575) | |
W/Bundle (5119): at com.android.mail.compose.ComposeActivity.onCreate(SourceFile:437) | |
W/Bundle (5119): at com.android.mail.compose.g.onCreate(SourceFile:62) | |
W/Bundle (5119): at com.google.android.gm.AutoSendActivity.onCreate(SourceFile:27) | |
W/Bundle (5119): at android.app.Activity.performCreate(Activity.java:5231) | |
W/Bundle (5119): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087) | |
W/Bundle (5119): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2169) | |
W/Bundle (5119): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2265) | |
W/Bundle (5119): at android.app.ActivityThread.access$800(ActivityThread.java:145) | |
W/Bundle (5119): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1206) | |
W/Bundle (5119): at android.os.Handler.dispatchMessage(Handler.java:102) | |
W/Bundle (5119): at android.os.Looper.loop(Looper.java:136) | |
W/Bundle (5119): at android.app.ActivityThread.main(ActivityThread.java:5081) | |
W/Bundle (5119): at java.lang.reflect.Method.invokeNative(Native Method) | |
W/Bundle (5119): at java.lang.reflect.Method.invoke(Method.java:515) | |
W/Bundle (5119): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:781) | |
W/Bundle (5119): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597) | |
W/Bundle (5119): at de.robv.android.xposed.XposedBridge.main(XposedBridge.java:126) | |
W/Bundle (5119): at dalvik.system.NativeStart.main(Native Method) | |
D/AndroidRuntime(5119): Shutting down VM | |
W/dalvikvm(5119): threadid=1: thread exiting with uncaught exception (group=0x419a5c68) | |
E/AndroidRuntime(5119): FATAL EXCEPTION: main | |
E/AndroidRuntime(5119): Process: com.google.android.gm, PID: 5119 | |
E/AndroidRuntime(5119): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.google.android.gm/com.google.android.gm.AutoSendActivity}: java.lang.NullPointerException | |
E/AndroidRuntime(5119): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2215) | |
E/AndroidRuntime(5119): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2265) | |
E/AndroidRuntime(5119): at android.app.ActivityThread.access$800(ActivityThread.java:145) | |
E/AndroidRuntime(5119): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1206) | |
E/AndroidRuntime(5119): at android.os.Handler.dispatchMessage(Handler.java:102) | |
E/AndroidRuntime(5119): at android.os.Looper.loop(Looper.java:136) | |
E/AndroidRuntime(5119): at android.app.ActivityThread.main(ActivityThread.java:5081) | |
E/AndroidRuntime(5119): at java.lang.reflect.Method.invokeNative(Native Method) | |
E/AndroidRuntime(5119): at java.lang.reflect.Method.invoke(Method.java:515) | |
E/AndroidRuntime(5119): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:781) | |
E/AndroidRuntime(5119): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597) | |
E/AndroidRuntime(5119): at de.robv.android.xposed.XposedBridge.main(XposedBridge.java:126) | |
E/AndroidRuntime(5119): at dalvik.system.NativeStart.main(Native Method) | |
E/AndroidRuntime(5119): Caused by: java.lang.NullPointerException | |
E/AndroidRuntime(5119): at android.content.ContentResolver.acquireExistingProvider(ContentResolver.java:1392) | |
E/AndroidRuntime(5119): at android.content.ContentResolver.getType(ContentResolver.java:304) | |
E/AndroidRuntime(5119): at com.android.mail.compose.AttachmentsView.m(SourceFile:217) | |
E/AndroidRuntime(5119): at com.android.mail.compose.ComposeActivity.a(SourceFile:664) | |
E/AndroidRuntime(5119): at com.android.mail.compose.ComposeActivity.zR(SourceFile:575) | |
E/AndroidRuntime(5119): at com.android.mail.compose.ComposeActivity.onCreate(SourceFile:437) | |
E/AndroidRuntime(5119): at com.android.mail.compose.g.onCreate(SourceFile:62) | |
E/AndroidRuntime(5119): at com.google.android.gm.AutoSendActivity.onCreate(SourceFile:27) | |
E/AndroidRuntime(5119): at android.app.Activity.performCreate(Activity.java:5231) | |
E/AndroidRuntime(5119): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087) | |
E/AndroidRuntime(5119): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2169) | |
E/AndroidRuntime(5119): ... 12 more | |
I/Process (5119): Sending signal. PID: 5119 SIG: 9 | |
W/ActivityManager(496): Force finishing activity com.google.android.gm/.AutoSendActivity | |
I/ActivityManager(496): Process com.google.android.gm (pid 5119) has died. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
How can I add from address., if have multiple accounts configured with gmail app?