Create Inbound Emails

Hi there,

I just want to create some inbound emails from my inbox.

from exchangelib import Credentials, Account, Configuration, DELEGATE
from pathlib import Path
import dotenv
import argparse
import os
import proteus 
from proteus import Model

....

# Modell für eingehende Mails laden
    InboundEmail = Model.get('inbound.email')
    InboundEmailInbox = Model.get('inbound.email.inbox')

    try:
        inbox, = InboundEmailInbox.find([('identifier', '=', os.getenv('tryton_inbox'))])
    except Exception as e:
        print(f"Error finding inbox: {e}")
        raise SystemExit("script stopped")

    for mail in folder_in.all().order_by('-datetime_received')[:10]:
        print(f"Processing mail: {mail.subject} from {mail.sender.email_address} received at {mail.datetime_received}")
        try:
            # Mail in trytond speichern
            inbound_mail = InboundEmail()
            inbound_mail.inbox = inbox
            inbound_mail.data = mail.mime_content
            inbound_mail.data_type = 'raw'
            inbound_mail.save()
            print(f"Mail saved in trytond with id: {inbound_mail.id}")

            # Mail in den erledigt Ordner verschieben
            mail.move(folder_out)
            print("Mail moved to 'Lieferantenrechnungen-erledigt' folder")
        except Exception as e:
            print(f"Error processing mail: {e}")

On save I receive the error

Error processing email: <Fault 1: ‘A value is required for the “Data Type” field in “Incoming Email”. - ’>

obviously I set data_type to raw, what do I miss?

Thanks