[ 
https://issues.apache.org/jira/browse/IMAP-257?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12995351#comment-12995351
 ] 

Jeff Huff commented on IMAP-257:
--------------------------------

This is very odd.  In another case, I clone a message from the Drafts folder 
and send it and also append it to the Sent folder.  The sent mail gets 
delivered with the From address, the appended message does not have the From 
address.


                // Get the source message from Drafts
                MimeMessage sourceMsg = (MimeMessage)source.getMessage 
(m_messageIds[0]);
                
                // Clone the original draft and update the changes
                MimeMessage message = new MimeMessage(sourceMsg);
                if (logger.isFinestLoggable ())
                {
                    logger.finest("Cloned From address: " + 
String.valueOf(message.getFrom ()));
                }
                message.setFrom (m_fromAddress);  // Should not have to do this 
and the cloned from is there
                message.setSentDate(new Date());
                message.setRecipients (RecipientType.TO, m_toAddresses);
                message.setRecipients (RecipientType.CC, m_ccAddresses);
                message.setSubject (m_subject);
                MailUtil.setText (message, m_messageText);
                MailUtil.setPHIHeader (message, m_phi);
                MailUtil.setContextData (message, m_phiData);
                MailUtil.setHighPriority (message, m_priority);
                message.saveChanges ();
                
                if (m_type == CommandType.SEND)
                {
                    message.setHeader("X-Mailer", "CarefxSecureInbox");
                    message.setFlag (Flags.Flag.DRAFT, false);
                    
                    // Send the message
                    logger.finest("Sending message");
                    Transport.send (message);
                    
                    if (logger.isFinestLoggable ())
                    {
                        logger.finest ("Copying message to folder " + 
target.getFullName ());
                    }

                    // Save a copy in the target folder Sent
                    target.appendMessages (new Message[] { message });
                }
                else
                {
                    // Save the updated draft
                    source.appendMessages (new Message[] { message });
                }
         
                // Delete the original draft
                sourceMsg.setFlag (Flags.Flag.DELETED, true);
                
                // Close the source and expunge
                if (source.isOpen ())
                {
                    source.close (true);
                }


The message saved in Sent...
Message-ID: <1460821906.6.1297870952766.JavaMail.jhuff@localhost>
MIME-Version: 1.0
Content-Type: multipart/mixed; 
        boundary="----=_Part_3_881188600.1297870940779"
Date: Wed, 16 Feb 2011 08:42:32 -0700 (MST)
To: Jeff Huff <jhuff@localhost>
Subject: test
X-PHI: False
X-Mailer: CarefxSecureInbox

------=_Part_3_881188600.1297870940779
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit

test
------=_Part_3_881188600.1297870940779--


The message recieved to INBOX...

Return-Path: <jhuff@localhost>
MIME-Version: 1.0
Received: from 127.0.0.1 ([127.0.0.1])
          by 169.254.53.191 (JAMES SMTP Server ) with ESMTP ID 2082453048
          for <jhuff@localhost>;
          Wed, 16 Feb 2011 08:42:33 -0700 (MST)
From: Jeff Huff <jhuff@localhost>
Message-ID: <1460821906.6.1297870952766.JavaMail.jhuff@localhost>
Content-Type: multipart/mixed; 
        boundary="----=_Part_3_881188600.1297870940779"
Date: Wed, 16 Feb 2011 08:42:32 -0700 (MST)
To: Jeff Huff <jhuff@localhost>
Subject: test
X-PHI: False
X-Mailer: CarefxSecureInbox

------=_Part_3_881188600.1297870940779
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit

test
------=_Part_3_881188600.1297870940779--

The only difference is the From address is not there on the Sent folder message 
that was appended.

I am having a hard time finding the IMAP code that saves the folders.  I can 
help look if I know which project it is in.  james-imap, or james-server?


> appendMessages(Message[]) does not save the from address
> --------------------------------------------------------
>
>                 Key: IMAP-257
>                 URL: https://issues.apache.org/jira/browse/IMAP-257
>             Project: JAMES Imap
>          Issue Type: Bug
>            Reporter: Jeff Huff
>
> Creating a new empty message in a Drafts folder stopped saving the from 
> address when calling appendMessages(Message[]).
>             InternetAddress addr = new InternetAddress ("jhuff@localhost", 
> "Jeff Huff");
>             Message message = new MimeMessage(session);
>             message.setFrom (addr);
>             message.setFlag (Flags.Flag.DRAFT, true);
>             message.setText ("");
>             message.saveChanges ();
>             messageUID = drafts.getUIDNext ();
>             drafts.appendMessages (new Message[] { message });
>             System.out.println("MessageUID=" + messageUID);
> Yet if you add a call to setSentDate(new Date()); on a MimeMessage right 
> after setFrom, it will set the From address.  I have tried calling other 
> methods to get it to refresh the headers, but nothing else seems to cause the 
> from address to stick when added to the folder.
> This was working in M2.

-- 
This message is automatically generated by JIRA.
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to