Hi,

I use the python email library for an Automation Test Framework. The framework test a Mail Transfert Agent. I notice that the "email" library silently fix a lot of MIME errors. I can understand this behaviour, but I need to validate that the email sent by the MTA are correct. I wonder if there's a way to use the python MIME Parser more "aggressively" (without modifying the email) and raise and exception as soon as an error is detected.

Here's my needs and an extract of my python:

  # Parse the received email
  try:
    received_email = email.message_from_string(args)
  except email.errors.MessageError, msg:
    self.ok((False, msg), msg)

I test with an invalid email (for example, with a missing closed boundary), and no exception is raised. The email lib fixes the issue.

Is there a way to tell the email lib to not modify the email, and raise an exception ?

Regards,

-- Xavier

QA Engineer at Cloudmark Labs.
_______________________________________________
Email-SIG mailing list
Email-SIG@python.org
Your options: 
http://mail.python.org/mailman/options/email-sig/archive%40mail-archive.com

Reply via email to