Razr M - Reply/Forward email does not include original message

kconti1021

New member
Dec 17, 2012
1
0
0
Visit site
Hello everyone,

My CEO got a RAZR M not too long ago and he is having an issue with replying and forwarding emailing messages. It doesn't matter if I check off/on the box to use original message in the email...it only sends an email with the current message. This is using the stock android exchange email client. I realize this has been talked about in the past with different phones, but I never really saw a true fix for this except "it suddenly started working today".

Please help,

Kyle
 

SW686

New member
Dec 24, 2012
2
0
0
Visit site
My CEO got a RAZR M not too long ago and he is having an issue with replying and forwarding emailing messages. It doesn't matter if I check off/on the box to use original message in the email...it only sends an email with the current message. This is using the stock android exchange email client. I realize this has been talked about in the past with different phones, but I never really saw a true fix for this except "it suddenly started working today".

The MotoEmail client, like the stock Email.apk, will probably try to use the SmartReply/SmartForward protocol operations on ActiveSync servers that support them. These commands handle the original message on the server side. If the server side does not properly support them, the original messages might go missing.

One possible option is to switch to IMAP.

Another possibility (untested) is to root the phone and edit the MotoEmail smali to try to disable the "smartSend" flag. I have not seen source code for the Motorola implementation, but their apk has some overlap with the stock AOSP 4.1.1 code. From packages/apps/Exchange/exchange2/src/com/android/exchange/EasOutboxService.java:

Code:
    int sendMessage(File cacheDir, long msgId) throws IOException, MessagingException {
        // We always return SUCCESS unless the sending error is account-specific (security or
        // authentication) rather than message-specific; returning anything else will terminate
        // the Outbox sync! Message-specific errors are marked in the messages themselves.
        int result = EmailServiceStatus.SUCCESS;
        // Say we're starting to send this message
        sendCallback(msgId, null, EmailServiceStatus.IN_PROGRESS);
        // Create a temporary file (this will hold the outgoing message in RFC822 (MIME) format)
        File tmpFile = File.createTempFile("eas_", "tmp", cacheDir);
        try {
            // Get the message and fail quickly if not found
            Message msg = Message.restoreMessageWithId(mContext, msgId);
            if (msg == null) return EmailServiceStatus.MESSAGE_NOT_FOUND;

            // See what kind of outgoing messge this is
            int flags = msg.mFlags;
            boolean reply = (flags & Message.FLAG_TYPE_REPLY) != 0;
            boolean forward = (flags & Message.FLAG_TYPE_FORWARD) != 0;
            boolean includeQuotedText = (flags & Message.FLAG_NOT_INCLUDE_QUOTED_TEXT) == 0;

            // The reference message and mailbox are called item and collection in EAS
            OriginalMessageInfo referenceInfo = null;
            // Respect the sense of the include quoted text flag
            if (includeQuotedText && (reply || forward)) {
                referenceInfo = getOriginalMessageInfo(mContext, msgId);
            }
            // Generally, we use SmartReply/SmartForward if we've got a good reference
            [color=red]boolean smartSend = referenceInfo != null;[/color]
            // But we won't use SmartForward if the account isn't set up for it (currently, we only
            // use SmartForward for EAS 12.0 or later to avoid creating eml files that are
            // potentially difficult for the recipient to handle)
            if (forward && ((mAccount.mFlags & Account.FLAGS_SUPPORTS_SMART_FORWARD) == 0)) {
                smartSend = false;
            }

            // Write the message to the temporary file
            FileOutputStream fileOutputStream = new FileOutputStream(tmpFile);
            Rfc822Output.writeTo(mContext, msgId, fileOutputStream, [color=red]smartSend[/color], true);

In smali/com/android/exchange/EasOutboxService.smali look around line 3355:

Code:
    invoke-static {v4, v0, v1}, Lcom/moxier/eas/engine/EasOutboxService;->getOriginalMessageInfo(Landroid/content/Context;J)Lcom/moxier/eas/engine/EasOutboxService$OriginalMessageInfo;
    :try_end_1
    .catchall {:try_start_1 .. :try_end_1} :catchall_1
    .catch Ljava/io/IOException; {:try_start_1 .. :try_end_1} :catch_c
    .catch Lcom/moxier/eas/engine/job/adapter/EasCommonException; {:try_start_1 .. :try_end_1} :catch_a
    .catch Lcom/android/emailcommon/mail/MessagingException; {:try_start_1 .. :try_end_1} :catch_8

    move-result-object v78

    .line 437
    :cond_5
    if-eqz v78, :cond_e

    const/4 v10, [color=red]0x1[/color]

Try changing 0x1 to 0x0 and see what happens. No guarantees as this function is considerably different from AOSP.