Trying to attach a file from SD Card to email

Also getting the same problem Code: Intent emailIntent = new Intent(android.content.Intent.ACTION_SEND); emailIntent.setType(“image/jpeg”); emailIntent.putExtra(android.content.Intent.EXTRA_EMAIL, new String[] {“me@gmail.com”}); emailIntent.putExtra(android.content.Intent.EXTRA_SUBJECT, “Test Subject”); emailIntent.putExtra(android.content.Intent.EXTRA_TEXT, “go on read the emails”); Log.v(getClass().getSimpleName(), “sPhotoUri=” + Uri.parse(“file:/”+ sPhotoFileName)); emailIntent.putExtra(Intent.EXTRA_STREAM, Uri.parse(“file:/”+ sPhotoFileName)); startActivity(Intent.createChooser(emailIntent, “Send mail…”)); From adb logcat: V/DumbDumpersMain( 3972): sPhotoUri=file://sdcard/DumbDumpers/DumbDumper.jpg I/ActivityManager( 56): Starting activity: Intent { action=android.intent.action.CHOOSER comp={android/com.android.internal.app.ChooserActivity} (has extras) } I/ActivityManager( 56): … Read more

Download file inside WebView

Have you tried? mWebView.setDownloadListener(new DownloadListener() { public void onDownloadStart(String url, String userAgent, String contentDisposition, String mimetype, long contentLength) { Intent i = new Intent(Intent.ACTION_VIEW); i.setData(Uri.parse(url)); startActivity(i); } }); Example Link: Webview File Download – Thanks @c49

Download attachments using Java Mail

Without exception handling, but here goes: List<File> attachments = new ArrayList<File>(); for (Message message : temp) { Multipart multipart = (Multipart) message.getContent(); for (int i = 0; i < multipart.getCount(); i++) { BodyPart bodyPart = multipart.getBodyPart(i); if(!Part.ATTACHMENT.equalsIgnoreCase(bodyPart.getDisposition()) && StringUtils.isBlank(bodyPart.getFileName())) { continue; // dealing with attachments only } InputStream is = bodyPart.getInputStream(); // — EDIT — … Read more

Android multiple email attachments using Intent

Here is the code you need to create an emailIntent that contains multiple attachments. public static void email(Context context, String emailTo, String emailCC, String subject, String emailText, List<String> filePaths) { //need to “send multiple” to get more than one attachment final Intent emailIntent = new Intent(Intent.ACTION_SEND_MULTIPLE); emailIntent.setType(“text/plain”); emailIntent.putExtra(android.content.Intent.EXTRA_EMAIL, new String[]{emailTo}); emailIntent.putExtra(android.content.Intent.EXTRA_CC, new String[]{emailCC}); emailIntent.putExtra(Intent.EXTRA_SUBJECT, subject); … Read more

Sending email with attachments from C#, attachments arrive as Part 1.2 in Thunderbird

Simple code to send email with attachement. source: http://www.coding-issues.com/2012/11/sending-email-with-attachments-from-c.html using System.Net; using System.Net.Mail; public void email_send() { MailMessage mail = new MailMessage(); SmtpClient SmtpServer = new SmtpClient(“smtp.gmail.com”); mail.From = new MailAddress(“your mail@gmail.com”); mail.To.Add(“to_mail@gmail.com”); mail.Subject = “Test Mail – 1”; mail.Body = “mail with attachment”; System.Net.Mail.Attachment attachment; attachment = new System.Net.Mail.Attachment(“c:/textfile.txt”); mail.Attachments.Add(attachment); SmtpServer.Port = 587; SmtpServer.Credentials … Read more