android2.3中,转发带附件的邮件时,新建的邮件中没有相应的附件。查看源码发现,确实没有相关实现,但貌似有实现的源码被注释掉了。求大体思路~~~~~

解决方案 »

  1.   

    功能被封掉了? 把附件下载到本地。
    楼主可以做个参考:
    File file = new File("\sdcard\android123.cwj"); //附件文件地址 Intent intent = new Intent(Intent.ACTION_SEND);
     intent.putExtra("subject", file.getName()); //
     intent.putExtra("body", "android123 - email sender"); //正文
     intent.putExtra(Intent.EXTRA_STREAM, Uri.fromFile(file)); //添加附件,附件为file对象
                if (file.getName().endsWith(".gz")) {
                    intent.setType("application/x-gzip"); //如果是gz使用gzip的mime
                } else if (file.getName().endsWith(".txt")) {
                    intent.setType("text/plain"); //纯文本则用text/plain的mime
                } else {
                    intent.setType("application/octet-stream"); //其他的均使用流当做二进制数据来发送
                }
      startActivity(intent); //调用系统的mail客户端进行发送
      

  2.   

    一定要使自带的 mail吗 可否利用javamail转发附件
      

  3.   

    已解决 与大家分享一下:
    /*******转发代码********/     if (!loadAttachments(message, 0)) {
              mHandler.sendEmptyMessage(MSG_SKIPPED_ATTACHMENTS);
         }     private boolean loadAttachments(Message message, int depth){
          try{
             Attachment[] attachments = Attachment.restoreAttachmentsWithMessageId(this, message.mId);
          for(final Attachment attachment:attachments){
          mHandler.post(new Runnable() {
                         public void run() {
                          Uri aUri = Uri.parse(attachment.mContentUri);
                             addAttachment(aUri);
                         }
                     });
          }
          return true;
          }catch(Exception ex){
           ex.printStackTrace();
          return false;
          }
         }