I want to send image to email. now i am selecting image from gallery and it is displaying in emulator but i need to send same image to email.
My Code is....
Main Activity
public void onActivityResult(int requestCode, int resultCode, Intent data) {
if (resultCode == RESULT_OK) {
if (requestCode == SELECT_PICTURE) {
// Get the url from data
Uri selectedImageUri = data.getData();
if (null != selectedImageUri) {
// Get the path from the Uri
String path = getPathFromURI(selectedImageUri);
Log.i(TAG, "Image Path : " + path);
// Set the image in ImageView
iv.setImageURI(selectedImageUri);
}
}
}
}
i was Passing Values as... Last Argument is for Image
new SendMailTask(Main2Activity.this).execute("hari.androidxxx@gmail.com",
"unixxxxx", toEmails, "Testing", mbody, ???);//i don't know last argument how to send
Here i Have to Display...
public MimeMessage createEmailMessage() throws AddressException,
MessagingException, UnsupportedEncodingException {
mailSession = Session.getDefaultInstance(emailProperties, null);
emailMessage = new MimeMessage(mailSession);
emailMessage.setFrom(new InternetAddress(fromEmail, fromEmail));
Log.i("GMail","toEmail: "+toEmailList);
emailMessage.addRecipient(Message.RecipientType.TO,
new InternetAddress(toEmailList));
emailMessage.setSubject(emailSubject);
emailMessage.setContent(emailBody+,"text/html");// Here I have to display
// emailMessage.setText(emailBody);// for a text email
Log.i("GMail", "Email Message created.");
return emailMessage;
}
Thanks In Advance...