<s> '''<STR_LIT>''' <EOL> from python_toolbox . third_party import envelopes <EOL> from python_toolbox import monkeypatching_tools <EOL> @ monkeypatching_tools . monkeypatch ( envelopes . Envelope ) <EOL> def add_attachment_from_string ( self , file_data , file_name , <EOL> mimetype = '<STR_LIT>' ) : <EOL> from python_toolbox . third_party . envelopes . envelope import MIMEBase , email_encoders , os <EOL> type_maj , type_min = mimetype . split ( '<STR_LIT:/>' ) <EOL> part = MIMEBase ( type_maj , type_min ) <EOL> part . set_payload ( file_data ) <EOL> email_encoders . encode_base64 ( part ) <EOL> part . add_header ( '<STR_LIT>' , '<STR_LIT>' <EOL> % file_name ) <EOL> self . _parts . append ( ( mimetype , part ) ) </s>
