Sunday, December 12, 2010

How to attach file in email

Hi this is my first blog hope this will help you.
Thanks.............

 attaching file in email is simple here is my code.....


public void sendMail(String emailid,String mailbody){

final Intent emailIntent = new Intent(android.content.Intent.ACTION_SEND);
                               
emailIntent.setType("image/png");
emailIntent.putExtra(Intent.EXTRA_STREAM, Uri.parse("file://"+Environment.getExternalStorageDirectory()+"nameof your file"));
        emailIntent.putExtra(android.content.Intent.EXTRA_EMAIL, new String[]{emailid});
        emailIntent.putExtra(android.content.Intent.EXTRA_SUBJECT,"Transaction Details");
        emailIntent.putExtra(android.content.Intent.EXTRA_TEXT,mailbody);
    
        try {
        this.startActivity(Intent.createChooser(emailIntent, "Send mail..."));
        } catch (android.content.ActivityNotFoundException ex) {
      
        Toast.makeText(this, "There are no email clients installed.", Toast.LENGTH_SHORT).show();
        }

}

4 comments:

  1. Sir,

    Can please tell me, how to generate qrcode in android.

    if i have a number how to convert that into qrcode in android. if possible please send the the source code.

    i learned the zxing project but it is having some error.

    Error: Sorry, sorry, the android camera encountered a problem. you may need to restart the device

    My Mail Id: Shankarraopilli@gmail.com

    ReplyDelete
  2. The nice code written on this post which is useful for me to attach a file in E-mail on android smartphone so thanks for providing this information.

    Android App Development

    ReplyDelete
  3. And, if you are a Gmail user, you do not need to worry about anything. Besides the official Gmail technical support services, the third party Gmail customer service providers are also available at your closest disposal, and you can get any kind of technical support as and when required.
    Gmail Support

    ReplyDelete