When I use the code to send email with attachment then the in the "TO"
field the complete file address/path also gets appended due to which
it gives error for sending mail. Does this is the known issue? I have
used  below code to send email with attachment.


                                Intent sendPhotoIntent = new 
Intent(Intent.ACTION_SEND);

                                // sendPhotoIntent.setType("message/rfc822");
                            // sendPhotoIntent.setType("image/jpeg");

                                try
                                {
                                Uri target = Uri.fromFile(new
File(strAccidentPhotoPath).getCanonicalFile());

                                sendPhotoIntent.putExtra(Intent.EXTRA_TEXT, 
"Accident
Photo"+strAccidentPhotoPath);
                                sendPhotoIntent.putExtra(Intent.EXTRA_SUBJECT, 
"Photo");
                                
sendPhotoIntent.setDataAndType(target,"image/jpeg");
                                sendPhotoIntent.putExtra(Intent.EXTRA_EMAIL, 
mailto);

                                if(target != null)
                                        
sendPhotoIntent.putExtra(Intent.EXTRA_STREAM,target);

                                Bundle emailContents = 
sendPhotoIntent.getExtras();
                                String emailTo = 
emailContents.getString(Intent.EXTRA_EMAIL);

                                
startActivity(Intent.createChooser(sendPhotoIntent,"Email Send"));

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to