1 #! /usr/bin/env python3
2 # -*- coding: utf-8 -*-
4 """***********************************************************************
5 * "flatten-mime" is free software: you can redistribute it and/or modify *
6 * it under the terms of the GNU Affero Public License as published by *
7 * the Free Software Foundation, either version 3 of the License, or *
8 * (at your option) any later version. *
10 * "flatten-mime" is distributed in the hope that it will be useful, *
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
13 * GNU Affero Public License for more details. *
15 * You should have received a copy of the GNU Affero Public License *
16 * along with Edward. If not, see <http://www.gnu.org/licenses/>. *
18 * Copyright (C) 2015 Andrew Engelbrecht (AGPLv3+) *
19 **************************************************************************
27 mime_text
= sys
.stdin
.read()
29 email_struct
= email
.parser
.Parser().parsestr(mime_text
)
31 for subpart
in email_struct
.walk():
32 payload_b
= subpart
.get_payload(decode
=True)
35 payload
= payload_b
.decode("utf-8")