0

First - I use the exchangelib package to connect to EWS exchange.

I will create a reply to the email as follows:

msg = acc.inbox.all().order_by('-datetime_received')[-1]
mgs.reply_all("Re: Subject", "body of email")

But the response created this way doesn't have the mime_content option, which I need to be able to save the email as .eml or .msg.

The msg variable has mime_content.

Is there a way to create an email reply with mime_content?

Thanks a lot!

Javad
  • 2,033
  • 3
  • 13
  • 23
exik
  • 3
  • 3

1 Answers1

0

reply_all() does not return anything. It's just a helper for sending a reply to the email it's called on.

If you want to access the Message item that the reply created, you need to search your "Sent" folder for the reply. That message has the mime_content field you're looking for.

If you call msg.create_reply_all(subject, body).send() instead, then you should get back the ID of the item stored in the "Sent" folder so you don't have to search for it.

Erik Cederstrand
  • 9,643
  • 8
  • 39
  • 63
  • I replied as answer. Unfortunately, I don't know how to make it clear in the comment. – exik Dec 06 '22 at 08:56
  • my next attemp: create new `Message` like reply: `m = Message(account = acc, folder = acc.sent, subject = f"Re: {email.subject}", body = new_body, to_recipients=[Mailbox(email_address=email.sender.email_address)] )` but `m` has mime_contente `None` – exik Dec 08 '22 at 07:00