Sending Email with attachment in network from my Android app
<p>I want to create one application which send email with attachment(select file from<br>
SD card/gallery). I try to find relevent code but i did'nt find it.<br>
Please provide me some code.<br>
Here is sample code for sending mail.<br>
Thanks in advance.  </p>

<pre><code>  Sendbtn.setOnClickListener(new View.OnClickListener()
   {

    @Override
    public void onClick(View v) 
    {
        // TODO Auto-generated method stub
        String TO,CC,Subject,Body,URL;
        try
        {
        URL = Environment.getExternalStorageDirectory()
                .getAbsolutePath() + "/temp";

                File file = new File(URL);
                if (!file.exists())
                file.mkdirs();
                URL = URL + "/report.html";
                createFile();
                //
                Log.i(getClass().getSimpleName(), "send  task - start");
                //
                final Intent emailIntent = new Intent(
                android.content.Intent.ACTION_SEND);
                //
                TO=(TOEText.getText().toString());
                CC=(CCEText.getText().toString());
                Subject=(SubjectEText.getText().toString());
                URL=(BrowseEText.getText().toString());
                Body=(BodyEText.getText().toString());

                //
                emailIntent.setType("plain/text");

                emailIntent.putExtra(android.content.Intent.EXTRA_EMAIL,
                new String[] { TO });

                emailIntent.putExtra(android.content.Intent.EXTRA_SUBJECT, Subject);

                emailIntent.putExtra(Intent.EXTRA_STREAM,
                Uri.parse("file://" + URL));

                emailIntent.putExtra(android.content.Intent.EXTRA_TEXT, Body);

                //this.startActivity(Intent
                //.createChooser(emailIntent, "Send mail..."));

            }
            catch (Throwable t)
            {
                Message(t);

            }
        }
   });
}
</code></pre>
