Search code examples
androidterminalandroid-emulatorshellcode

How to send email using terminal emulator android application


I want to send email from terminal android application. Is there any command for this or any email functions?


Solution

  • I, too, want to be able to send emails from terminal/shell scripts in Android. It took me over a week to figure out how to do it. Obstacles included:

    1. Android's default command line toolbox doesn't offer this functionality
    2. The busybox (v1.22.1 bionic) on my android device (MotoG with CyanogenMod 11) seems to have been compiled without the sendmail applet (!?)
    3. Judging from the fact that I was not able to find an answer to your question anywhere, it seems that not many people seem to care about this functionality

    I finally did find a simple solution: curl. It is dead-simple to get it working, but only if you have root access to your device. Here's how to set it up:

    A. On your computer (desktop or laptop):

    1. Download the curl package for android available here: http://curl.haxx.se/download.html (scroll down until you find the version for android)
    2. Extract the package's contents using your preferred application

    B. Use USB cable to plug your android device into your computer

    C. Copy the curl binary from your computer (/data/local/bin/curl in the extracted package) to somewhere in your android device's PATH (I copied it into the /system/xbin directory) and make sure that the file is executable

    D. Disconnect device from your computer and happy emailing!

    Now you can use curl at the command line (or in your shell scripts) to send emails. Usage example is here: Using curl to send email. You can even send text messages! (see here: http://osxdaily.com/2014/03/12/send-sms-text-message-from-command-line/)