public static Intent newEmailIntent ( String [ ] addresses , String subject , String body , Uri attachment ) { Intent intent = new Intent ( Intent . ACTION_SEND ) ; if ( addresses != null ) intent . putExtra ( Intent . EXTRA_EMAIL , addresses ) ; if ( body != null ) intent . putExtra ( Intent . EXTRA_TEXT , body ) ; if ( subject != null ) intent . putExtra ( Intent . EXTRA_SUBJECT , subject ) ; if ( attachment != null ) intent . putExtra ( Intent . EXTRA_STREAM , attachment ) ; intent . setType ( MIME_TYPE_EMAIL ) ; return intent ; }
Create an intent to send an email with an attachment