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();
        }

}

7 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
  4. To attach a file: Click the Attachment or Include File icon, often represented by a paper clip. Locate the file on your computer's hard drive or other storage device from the window that opens requesting the name of the file. Select the file you want from the file attachment window. game development

    ReplyDelete
  5. You wrote very well your first blog.Thanks for sharing such a informative coding.waiting for your next blogs.

    Android app development company

    ReplyDelete