Extracting Email Headers in Python

Aspose.Email - Extracting Email Headers

To Extract Email Headers using Aspose.Email Java for Python, Use following code.

Python Code

\# Initialize and Load an existing EML file by specifying the MessageFormat

mailMessage = self.MailMessage

message = mailMessage.load(self.dataDir + "Message.eml")

print "Printing all Headers:"

\# Print out all the headers


while (i < message.getHeaders().getCount()):

    print message.getHeaders().get(i)

    i += 1

Download Running Code

Download Extracting Email Headers (Aspose.Email) from any of the below mentioned social coding sites: