title: How do I reply to an email using the Python imaplib and include the original message?
body: <p>I'm currently using <a href="http://docs.python.org/library/imaplib.html" rel="noreferrer"><code>imaplib</code></a> to fetch email messages from a server and process the contents and attachments.</p>
  
  <p>I'd like to reply to the messages with a status/error message and links to the resulting generated content on my site if they can be processed.  This should include the original message but should drop any attachments (which will be large) and preferably replace them with just their filenames/sizes.</p>
  
  <p>Since I'm already walking the MIME message parts, I'm assuming what I need to do is build a new MIME message tree containing a copy of the original message and delete/replace the attachment nodes.</p>
  
  <p>Before I start down that path, I was hoping someone can give me some tips.  Is there any kind of library function to do this? Any kind of standard behavior I should stick to? </p>
  
  <p>I currently know of/am using the <code>imaplib</code>, <code>smtplib</code> and <code>email</code> modules and but may have missed something obvious in there.  This is running in Django too, so can use anything in <code>django.core.email</code> if that makes it easier.</p>