<p>Here is how it works. The code is really straightforward in this area. ;-)</p>

<p>Pushing a mail on remote IMAP is called "APPEND". This is done in the <a href="https://github.com/OfflineIMAP/offlineimap/blob/next/offlineimap/folder/IMAP.py#L498">savemessage() method</a>.</p>

<p>This method applies the date as returned by the <a href="https://github.com/OfflineIMAP/offlineimap/blob/next/offlineimap/folder/IMAP.py#L422">__getmessageinternaldate() method</a>.</p>

<p>The local Maildir does NOT have real INTERNALDATE (as defined by IMAP standard). We fake it with the values taken from the <code>rtime</code> parameter (coming from <a href="https://github.com/OfflineIMAP/offlineimap/blob/next/offlineimap/folder/Maildir.py#L243">getmessagetime()</a>, the modification time of the file) and fallback to the header if it looks wrong.</p>

<p>I'm giving you the details because you might want to insert debug <code>print</code> statements to get where it might fail. The comments in the code are helpfull.</p>

<p style="font-size:small;-webkit-text-size-adjust:none;color:#666;">—<br>Reply to this email directly or <a href="https://github.com/OfflineIMAP/offlineimap/issues/186#issuecomment-87799438">view it on GitHub</a>.<img alt="" height="1" src="https://github.com/notifications/beacon/AKFSEI4qhXtvV7tHj0J3FskQjjBCHFEGks5n6ZrygaJpZM4D3PjG.gif" width="1" /></p>
<div itemscope itemtype="http://schema.org/EmailMessage">
  <div itemprop="action" itemscope itemtype="http://schema.org/ViewAction">
    <link itemprop="url" href="https://github.com/OfflineIMAP/offlineimap/issues/186#issuecomment-87799438"></link>
    <meta itemprop="name" content="View Issue"></meta>
  </div>
  <meta itemprop="description" content="View this Issue on GitHub"></meta>
</div>