Python email.MIMEBase.MIMEBase() Examples
The following are 30
code examples of email.MIMEBase.MIMEBase().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
email.MIMEBase
, or try the search function
.
Example #1
Source File: test_email.py From oss-ftp with MIT License | 6 votes |
def test__all__(self): module = __import__('email') all = module.__all__ all.sort() self.assertEqual(all, [ # Old names 'Charset', 'Encoders', 'Errors', 'Generator', 'Header', 'Iterators', 'MIMEAudio', 'MIMEBase', 'MIMEImage', 'MIMEMessage', 'MIMEMultipart', 'MIMENonMultipart', 'MIMEText', 'Message', 'Parser', 'Utils', 'base64MIME', # new names 'base64mime', 'charset', 'encoders', 'errors', 'generator', 'header', 'iterators', 'message', 'message_from_file', 'message_from_string', 'mime', 'parser', 'quopriMIME', 'quoprimime', 'utils', ])
Example #2
Source File: test_email.py From ironpython2 with Apache License 2.0 | 6 votes |
def test__all__(self): module = __import__('email') all = module.__all__ all.sort() self.assertEqual(all, [ # Old names 'Charset', 'Encoders', 'Errors', 'Generator', 'Header', 'Iterators', 'MIMEAudio', 'MIMEBase', 'MIMEImage', 'MIMEMessage', 'MIMEMultipart', 'MIMENonMultipart', 'MIMEText', 'Message', 'Parser', 'Utils', 'base64MIME', # new names 'base64mime', 'charset', 'encoders', 'errors', 'generator', 'header', 'iterators', 'message', 'message_from_file', 'message_from_string', 'mime', 'parser', 'quopriMIME', 'quoprimime', 'utils', ])
Example #3
Source File: test_email.py From CTFCrackTools-V2 with GNU General Public License v3.0 | 6 votes |
def test__all__(self): module = __import__('email') all = module.__all__ all.sort() self.assertEqual(all, [ # Old names 'Charset', 'Encoders', 'Errors', 'Generator', 'Header', 'Iterators', 'MIMEAudio', 'MIMEBase', 'MIMEImage', 'MIMEMessage', 'MIMEMultipart', 'MIMENonMultipart', 'MIMEText', 'Message', 'Parser', 'Utils', 'base64MIME', # new names 'base64mime', 'charset', 'encoders', 'errors', 'generator', 'header', 'iterators', 'message', 'message_from_file', 'message_from_string', 'mime', 'parser', 'quopriMIME', 'quoprimime', 'utils', ])
Example #4
Source File: test_email.py From ironpython2 with Apache License 2.0 | 6 votes |
def test_no_parts_in_a_multipart_with_empty_epilogue(self): outer = MIMEBase('multipart', 'mixed') outer['Subject'] = 'A subject' outer['To'] = 'aperson@dom.ain' outer['From'] = 'bperson@dom.ain' outer.preamble = '' outer.epilogue = '' outer.set_boundary('BOUNDARY') self.ndiffAssertEqual(outer.as_string(), '''\ Content-Type: multipart/mixed; boundary="BOUNDARY" MIME-Version: 1.0 Subject: A subject To: aperson@dom.ain From: bperson@dom.ain --BOUNDARY --BOUNDARY-- ''')
Example #5
Source File: test_email.py From ironpython2 with Apache License 2.0 | 6 votes |
def test_seq_parts_in_a_multipart_with_none_epilogue(self): eq = self.ndiffAssertEqual outer = MIMEBase('multipart', 'mixed') outer['Subject'] = 'A subject' outer['To'] = 'aperson@dom.ain' outer['From'] = 'bperson@dom.ain' outer.epilogue = None msg = MIMEText('hello world') outer.attach(msg) outer.set_boundary('BOUNDARY') eq(outer.as_string(), '''\ Content-Type: multipart/mixed; boundary="BOUNDARY" MIME-Version: 1.0 Subject: A subject To: aperson@dom.ain From: bperson@dom.ain --BOUNDARY Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit hello world --BOUNDARY-- ''')
Example #6
Source File: test_email.py From ironpython2 with Apache License 2.0 | 6 votes |
def test_one_part_in_a_multipart(self): eq = self.ndiffAssertEqual outer = MIMEBase('multipart', 'mixed') outer['Subject'] = 'A subject' outer['To'] = 'aperson@dom.ain' outer['From'] = 'bperson@dom.ain' outer.set_boundary('BOUNDARY') msg = MIMEText('hello world') outer.attach(msg) eq(outer.as_string(), '''\ Content-Type: multipart/mixed; boundary="BOUNDARY" MIME-Version: 1.0 Subject: A subject To: aperson@dom.ain From: bperson@dom.ain --BOUNDARY Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit hello world --BOUNDARY-- ''')
Example #7
Source File: test_email.py From ironpython2 with Apache License 2.0 | 6 votes |
def test_seq_parts_in_a_multipart_with_empty_epilogue(self): eq = self.ndiffAssertEqual outer = MIMEBase('multipart', 'mixed') outer['Subject'] = 'A subject' outer['To'] = 'aperson@dom.ain' outer['From'] = 'bperson@dom.ain' outer.epilogue = '' msg = MIMEText('hello world') outer.attach(msg) outer.set_boundary('BOUNDARY') eq(outer.as_string(), '''\ Content-Type: multipart/mixed; boundary="BOUNDARY" MIME-Version: 1.0 Subject: A subject To: aperson@dom.ain From: bperson@dom.ain --BOUNDARY Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit hello world --BOUNDARY-- ''')
Example #8
Source File: test_email.py From BinderFilter with MIT License | 6 votes |
def test__all__(self): module = __import__('email') all = module.__all__ all.sort() self.assertEqual(all, [ # Old names 'Charset', 'Encoders', 'Errors', 'Generator', 'Header', 'Iterators', 'MIMEAudio', 'MIMEBase', 'MIMEImage', 'MIMEMessage', 'MIMEMultipart', 'MIMENonMultipart', 'MIMEText', 'Message', 'Parser', 'Utils', 'base64MIME', # new names 'base64mime', 'charset', 'encoders', 'errors', 'generator', 'header', 'iterators', 'message', 'message_from_file', 'message_from_string', 'mime', 'parser', 'quopriMIME', 'quoprimime', 'utils', ])
Example #9
Source File: test_email.py From CTFCrackTools-V2 with GNU General Public License v3.0 | 6 votes |
def test_no_parts_in_a_multipart_with_empty_epilogue(self): outer = MIMEBase('multipart', 'mixed') outer['Subject'] = 'A subject' outer['To'] = 'aperson@dom.ain' outer['From'] = 'bperson@dom.ain' outer.preamble = '' outer.epilogue = '' outer.set_boundary('BOUNDARY') self.ndiffAssertEqual(outer.as_string(), '''\ Content-Type: multipart/mixed; boundary="BOUNDARY" MIME-Version: 1.0 Subject: A subject To: aperson@dom.ain From: bperson@dom.ain --BOUNDARY --BOUNDARY-- ''')
Example #10
Source File: test_email.py From oss-ftp with MIT License | 6 votes |
def test_no_parts_in_a_multipart_with_none_epilogue(self): outer = MIMEBase('multipart', 'mixed') outer['Subject'] = 'A subject' outer['To'] = 'aperson@dom.ain' outer['From'] = 'bperson@dom.ain' outer.set_boundary('BOUNDARY') self.ndiffAssertEqual(outer.as_string(), '''\ Content-Type: multipart/mixed; boundary="BOUNDARY" MIME-Version: 1.0 Subject: A subject To: aperson@dom.ain From: bperson@dom.ain --BOUNDARY --BOUNDARY-- ''')
Example #11
Source File: test_email.py From oss-ftp with MIT License | 6 votes |
def test_no_parts_in_a_multipart_with_empty_epilogue(self): outer = MIMEBase('multipart', 'mixed') outer['Subject'] = 'A subject' outer['To'] = 'aperson@dom.ain' outer['From'] = 'bperson@dom.ain' outer.preamble = '' outer.epilogue = '' outer.set_boundary('BOUNDARY') self.ndiffAssertEqual(outer.as_string(), '''\ Content-Type: multipart/mixed; boundary="BOUNDARY" MIME-Version: 1.0 Subject: A subject To: aperson@dom.ain From: bperson@dom.ain --BOUNDARY --BOUNDARY-- ''')
Example #12
Source File: test_email.py From oss-ftp with MIT License | 6 votes |
def test_one_part_in_a_multipart(self): eq = self.ndiffAssertEqual outer = MIMEBase('multipart', 'mixed') outer['Subject'] = 'A subject' outer['To'] = 'aperson@dom.ain' outer['From'] = 'bperson@dom.ain' outer.set_boundary('BOUNDARY') msg = MIMEText('hello world') outer.attach(msg) eq(outer.as_string(), '''\ Content-Type: multipart/mixed; boundary="BOUNDARY" MIME-Version: 1.0 Subject: A subject To: aperson@dom.ain From: bperson@dom.ain --BOUNDARY Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit hello world --BOUNDARY-- ''')
Example #13
Source File: test_email.py From CTFCrackTools-V2 with GNU General Public License v3.0 | 6 votes |
def test_no_parts_in_a_multipart_with_none_epilogue(self): outer = MIMEBase('multipart', 'mixed') outer['Subject'] = 'A subject' outer['To'] = 'aperson@dom.ain' outer['From'] = 'bperson@dom.ain' outer.set_boundary('BOUNDARY') self.ndiffAssertEqual(outer.as_string(), '''\ Content-Type: multipart/mixed; boundary="BOUNDARY" MIME-Version: 1.0 Subject: A subject To: aperson@dom.ain From: bperson@dom.ain --BOUNDARY --BOUNDARY--''')
Example #14
Source File: test_email.py From oss-ftp with MIT License | 6 votes |
def test_seq_parts_in_a_multipart_with_none_epilogue(self): eq = self.ndiffAssertEqual outer = MIMEBase('multipart', 'mixed') outer['Subject'] = 'A subject' outer['To'] = 'aperson@dom.ain' outer['From'] = 'bperson@dom.ain' outer.epilogue = None msg = MIMEText('hello world') outer.attach(msg) outer.set_boundary('BOUNDARY') eq(outer.as_string(), '''\ Content-Type: multipart/mixed; boundary="BOUNDARY" MIME-Version: 1.0 Subject: A subject To: aperson@dom.ain From: bperson@dom.ain --BOUNDARY Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit hello world --BOUNDARY-- ''')
Example #15
Source File: test_email.py From oss-ftp with MIT License | 6 votes |
def test_seq_parts_in_a_multipart_with_empty_epilogue(self): eq = self.ndiffAssertEqual outer = MIMEBase('multipart', 'mixed') outer['Subject'] = 'A subject' outer['To'] = 'aperson@dom.ain' outer['From'] = 'bperson@dom.ain' outer.epilogue = '' msg = MIMEText('hello world') outer.attach(msg) outer.set_boundary('BOUNDARY') eq(outer.as_string(), '''\ Content-Type: multipart/mixed; boundary="BOUNDARY" MIME-Version: 1.0 Subject: A subject To: aperson@dom.ain From: bperson@dom.ain --BOUNDARY Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit hello world --BOUNDARY-- ''')
Example #16
Source File: test_email.py From CTFCrackTools-V2 with GNU General Public License v3.0 | 6 votes |
def test_seq_parts_in_a_multipart_with_none_epilogue(self): eq = self.ndiffAssertEqual outer = MIMEBase('multipart', 'mixed') outer['Subject'] = 'A subject' outer['To'] = 'aperson@dom.ain' outer['From'] = 'bperson@dom.ain' outer.epilogue = None msg = MIMEText('hello world') outer.attach(msg) outer.set_boundary('BOUNDARY') eq(outer.as_string(), '''\ Content-Type: multipart/mixed; boundary="BOUNDARY" MIME-Version: 1.0 Subject: A subject To: aperson@dom.ain From: bperson@dom.ain --BOUNDARY Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit hello world --BOUNDARY--''')
Example #17
Source File: test_email.py From medicare-demo with Apache License 2.0 | 6 votes |
def test__all__(self): module = __import__('email') all = module.__all__ all.sort() self.assertEqual(all, [ # Old names 'Charset', 'Encoders', 'Errors', 'Generator', 'Header', 'Iterators', 'MIMEAudio', 'MIMEBase', 'MIMEImage', 'MIMEMessage', 'MIMEMultipart', 'MIMENonMultipart', 'MIMEText', 'Message', 'Parser', 'Utils', 'base64MIME', # new names 'base64mime', 'charset', 'encoders', 'errors', 'generator', 'header', 'iterators', 'message', 'message_from_file', 'message_from_string', 'mime', 'parser', 'quopriMIME', 'quoprimime', 'utils', ])
Example #18
Source File: test_email.py From medicare-demo with Apache License 2.0 | 6 votes |
def test_seq_parts_in_a_multipart_with_empty_epilogue(self): eq = self.ndiffAssertEqual outer = MIMEBase('multipart', 'mixed') outer['Subject'] = 'A subject' outer['To'] = 'aperson@dom.ain' outer['From'] = 'bperson@dom.ain' outer.epilogue = '' msg = MIMEText('hello world') outer.attach(msg) outer.set_boundary('BOUNDARY') eq(outer.as_string(), '''\ Content-Type: multipart/mixed; boundary="BOUNDARY" MIME-Version: 1.0 Subject: A subject To: aperson@dom.ain From: bperson@dom.ain --BOUNDARY Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit hello world --BOUNDARY-- ''')
Example #19
Source File: test_email.py From medicare-demo with Apache License 2.0 | 6 votes |
def test_seq_parts_in_a_multipart_with_none_epilogue(self): eq = self.ndiffAssertEqual outer = MIMEBase('multipart', 'mixed') outer['Subject'] = 'A subject' outer['To'] = 'aperson@dom.ain' outer['From'] = 'bperson@dom.ain' outer.epilogue = None msg = MIMEText('hello world') outer.attach(msg) outer.set_boundary('BOUNDARY') eq(outer.as_string(), '''\ Content-Type: multipart/mixed; boundary="BOUNDARY" MIME-Version: 1.0 Subject: A subject To: aperson@dom.ain From: bperson@dom.ain --BOUNDARY Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit hello world --BOUNDARY--''')
Example #20
Source File: test_email.py From medicare-demo with Apache License 2.0 | 6 votes |
def test_seq_parts_in_a_multipart_with_empty_preamble(self): eq = self.ndiffAssertEqual outer = MIMEBase('multipart', 'mixed') outer['Subject'] = 'A subject' outer['To'] = 'aperson@dom.ain' outer['From'] = 'bperson@dom.ain' outer.preamble = '' msg = MIMEText('hello world') outer.attach(msg) outer.set_boundary('BOUNDARY') eq(outer.as_string(), '''\ Content-Type: multipart/mixed; boundary="BOUNDARY" MIME-Version: 1.0 Subject: A subject To: aperson@dom.ain From: bperson@dom.ain --BOUNDARY Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit hello world --BOUNDARY--''')
Example #21
Source File: OpenCV.Sphinx.takePhotoSendEmailItalian.py From pyrobotlab with Apache License 2.0 | 6 votes |
def mail(to, subject, text, attach): msg = MIMEMultipart() msg['From'] = gmail_user msg['To'] = to msg['Subject'] = subject msg.attach(MIMEText(text)) part = MIMEBase('application', 'octet-stream') part.set_payload(open(attach, 'rb').read()) Encoders.encode_base64(part) part.add_header('Content-Disposition', 'attachment; filename="%s"' % os.path.basename(attach)) msg.attach(part) mailServer = smtplib.SMTP("smtp.gmail.com", 587) mailServer.ehlo() mailServer.starttls() mailServer.ehlo() mailServer.login(gmail_user, gmail_pwd) mailServer.sendmail(gmail_user, to, msg.as_string()) # Should be mailServer.quit(), but that crashes... mailServer.close()
Example #22
Source File: test_email.py From medicare-demo with Apache License 2.0 | 6 votes |
def test_one_part_in_a_multipart(self): eq = self.ndiffAssertEqual outer = MIMEBase('multipart', 'mixed') outer['Subject'] = 'A subject' outer['To'] = 'aperson@dom.ain' outer['From'] = 'bperson@dom.ain' outer.set_boundary('BOUNDARY') msg = MIMEText('hello world') outer.attach(msg) eq(outer.as_string(), '''\ Content-Type: multipart/mixed; boundary="BOUNDARY" MIME-Version: 1.0 Subject: A subject To: aperson@dom.ain From: bperson@dom.ain --BOUNDARY Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit hello world --BOUNDARY--''')
Example #23
Source File: test_email.py From medicare-demo with Apache License 2.0 | 6 votes |
def test_no_parts_in_a_multipart_with_empty_epilogue(self): outer = MIMEBase('multipart', 'mixed') outer['Subject'] = 'A subject' outer['To'] = 'aperson@dom.ain' outer['From'] = 'bperson@dom.ain' outer.preamble = '' outer.epilogue = '' outer.set_boundary('BOUNDARY') self.ndiffAssertEqual(outer.as_string(), '''\ Content-Type: multipart/mixed; boundary="BOUNDARY" MIME-Version: 1.0 Subject: A subject To: aperson@dom.ain From: bperson@dom.ain --BOUNDARY --BOUNDARY-- ''')
Example #24
Source File: test_email.py From datafari with Apache License 2.0 | 6 votes |
def test_no_parts_in_a_multipart_with_none_epilogue(self): outer = MIMEBase('multipart', 'mixed') outer['Subject'] = 'A subject' outer['To'] = 'aperson@dom.ain' outer['From'] = 'bperson@dom.ain' outer.set_boundary('BOUNDARY') self.ndiffAssertEqual(outer.as_string(), '''\ Content-Type: multipart/mixed; boundary="BOUNDARY" MIME-Version: 1.0 Subject: A subject To: aperson@dom.ain From: bperson@dom.ain --BOUNDARY --BOUNDARY-- ''')
Example #25
Source File: test_email.py From datafari with Apache License 2.0 | 6 votes |
def test_no_parts_in_a_multipart_with_empty_epilogue(self): outer = MIMEBase('multipart', 'mixed') outer['Subject'] = 'A subject' outer['To'] = 'aperson@dom.ain' outer['From'] = 'bperson@dom.ain' outer.preamble = '' outer.epilogue = '' outer.set_boundary('BOUNDARY') self.ndiffAssertEqual(outer.as_string(), '''\ Content-Type: multipart/mixed; boundary="BOUNDARY" MIME-Version: 1.0 Subject: A subject To: aperson@dom.ain From: bperson@dom.ain --BOUNDARY --BOUNDARY-- ''')
Example #26
Source File: test_email.py From datafari with Apache License 2.0 | 6 votes |
def test_one_part_in_a_multipart(self): eq = self.ndiffAssertEqual outer = MIMEBase('multipart', 'mixed') outer['Subject'] = 'A subject' outer['To'] = 'aperson@dom.ain' outer['From'] = 'bperson@dom.ain' outer.set_boundary('BOUNDARY') msg = MIMEText('hello world') outer.attach(msg) eq(outer.as_string(), '''\ Content-Type: multipart/mixed; boundary="BOUNDARY" MIME-Version: 1.0 Subject: A subject To: aperson@dom.ain From: bperson@dom.ain --BOUNDARY Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit hello world --BOUNDARY-- ''')
Example #27
Source File: test_email.py From medicare-demo with Apache License 2.0 | 6 votes |
def test_no_parts_in_a_multipart_with_none_epilogue(self): outer = MIMEBase('multipart', 'mixed') outer['Subject'] = 'A subject' outer['To'] = 'aperson@dom.ain' outer['From'] = 'bperson@dom.ain' outer.set_boundary('BOUNDARY') self.ndiffAssertEqual(outer.as_string(), '''\ Content-Type: multipart/mixed; boundary="BOUNDARY" MIME-Version: 1.0 Subject: A subject To: aperson@dom.ain From: bperson@dom.ain --BOUNDARY --BOUNDARY--''')
Example #28
Source File: test_email.py From datafari with Apache License 2.0 | 6 votes |
def test_seq_parts_in_a_multipart_with_none_epilogue(self): eq = self.ndiffAssertEqual outer = MIMEBase('multipart', 'mixed') outer['Subject'] = 'A subject' outer['To'] = 'aperson@dom.ain' outer['From'] = 'bperson@dom.ain' outer.epilogue = None msg = MIMEText('hello world') outer.attach(msg) outer.set_boundary('BOUNDARY') eq(outer.as_string(), '''\ Content-Type: multipart/mixed; boundary="BOUNDARY" MIME-Version: 1.0 Subject: A subject To: aperson@dom.ain From: bperson@dom.ain --BOUNDARY Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit hello world --BOUNDARY-- ''')
Example #29
Source File: test_email.py From datafari with Apache License 2.0 | 6 votes |
def test_seq_parts_in_a_multipart_with_empty_epilogue(self): eq = self.ndiffAssertEqual outer = MIMEBase('multipart', 'mixed') outer['Subject'] = 'A subject' outer['To'] = 'aperson@dom.ain' outer['From'] = 'bperson@dom.ain' outer.epilogue = '' msg = MIMEText('hello world') outer.attach(msg) outer.set_boundary('BOUNDARY') eq(outer.as_string(), '''\ Content-Type: multipart/mixed; boundary="BOUNDARY" MIME-Version: 1.0 Subject: A subject To: aperson@dom.ain From: bperson@dom.ain --BOUNDARY Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit hello world --BOUNDARY-- ''')
Example #30
Source File: test_email.py From datafari with Apache License 2.0 | 6 votes |
def test__all__(self): module = __import__('email') all = module.__all__ all.sort() self.assertEqual(all, [ # Old names 'Charset', 'Encoders', 'Errors', 'Generator', 'Header', 'Iterators', 'MIMEAudio', 'MIMEBase', 'MIMEImage', 'MIMEMessage', 'MIMEMultipart', 'MIMENonMultipart', 'MIMEText', 'Message', 'Parser', 'Utils', 'base64MIME', # new names 'base64mime', 'charset', 'encoders', 'errors', 'generator', 'header', 'iterators', 'message', 'message_from_file', 'message_from_string', 'mime', 'parser', 'quopriMIME', 'quoprimime', 'utils', ])