Advertisement
GeneralGDA

Send via e-mail

May 18th, 2015
505
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.47 KB | None | 0 0
  1. final Intent intent = new Intent(Intent.ACTION_SEND);
  2. intent.setType("message/rfc822");
  3. intent.putExtra(Intent.EXTRA_EMAIL, "some@mail.ru");
  4. intent.putExtra(Intent.EXTRA_SUBJECT, "subject");
  5. intent.putExtra(Intent.EXTRA_TEXT, "mail body");
  6.  
  7. final File logFile = ...
  8.  
  9. if (null != logFile && logFile.exists())
  10. {
  11.    intent.putExtra(Intent.EXTRA_STREAM, Uri.fromFile(logFile));
  12. }
  13.  
  14. context.startActivity(Intent.createChooser(intent, null)); // context - android.contetn.Context
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement