• Home
  • Raw
  • Download

Lines Matching refs:smtp

75         smtp = smtplib.SMTP(HOST, self.port)
76 smtp.close()
81 smtp = smtplib.SMTP(HOST, self.port,
83 self.assertEqual(smtp.source_address, ('127.0.0.1', 19876))
84 smtp.close()
89 smtp = smtplib.SMTP("%s:%s" % (HOST, self.port))
90 smtp.close()
95 smtp = smtplib.SMTP(HOST, self.port, local_hostname="testhost")
96 self.assertEqual(smtp.local_hostname, "testhost")
97 smtp.close()
105 smtp = smtplib.SMTP(HOST, self.port)
108 self.assertEqual(smtp.sock.gettimeout(), 30)
109 smtp.close()
116 smtp = smtplib.SMTP(HOST, self.port, timeout=None)
119 self.assertIsNone(smtp.sock.gettimeout())
120 smtp.close()
124 smtp = smtplib.SMTP(HOST, self.port, timeout=30)
125 self.assertEqual(smtp.sock.gettimeout(), 30)
126 smtp.close()
130 smtp = smtplib.SMTP()
131 smtp.set_debuglevel(1)
133 smtp.connect(HOST, self.port)
134 smtp.close()
140 smtp = smtplib.SMTP()
141 smtp.set_debuglevel(2)
143 smtp.connect(HOST, self.port)
144 smtp.close()
241 smtp = smtplib.SMTP(HOST, self.port, local_hostname='localhost', timeout=3)
242 smtp.quit()
248 smtp = smtplib.SMTP(self.host, self.port, local_hostname='localhost',
250 self.assertEqual(smtp.source_address, (self.host, src_port))
251 self.assertEqual(smtp.local_hostname, 'localhost')
252 smtp.quit()
259 smtp = smtplib.SMTP(HOST, self.port, local_hostname='localhost', timeout=3)
261 self.assertEqual(smtp.noop(), expected)
262 smtp.quit()
265 smtp = smtplib.SMTP(HOST, self.port, local_hostname='localhost', timeout=3)
267 self.assertEqual(smtp.rset(), expected)
268 smtp.quit()
272 smtp = smtplib.SMTP(HOST, self.port, local_hostname='localhost', timeout=3)
274 self.assertEqual(smtp.ehlo(), expected)
275 smtp.quit()
279 smtp = smtplib.SMTP(HOST, self.port, local_hostname='localhost', timeout=3)
281 smtp.putcmd('EXPN')
282 self.assertEqual(smtp.getreply(), expected)
283 smtp.quit()
286 smtp = smtplib.SMTP(HOST, self.port, local_hostname='localhost', timeout=3)
289 self.assertEqual(smtp.vrfy('nobody@nowhere.com'), expected)
290 self.assertEqual(smtp.verify('nobody@nowhere.com'), expected)
291 smtp.quit()
296 smtp = smtplib.SMTP(HOST, self.port, local_hostname='localhost', timeout=3)
297 smtp.helo()
299 self.assertEqual(smtp.helo(), expected)
300 smtp.quit()
303 smtp = smtplib.SMTP(HOST, self.port, local_hostname='localhost', timeout=3)
304 self.assertEqual(smtp.help(), b'Supported commands: EHLO HELO MAIL ' + \
306 smtp.quit()
311 smtp = smtplib.SMTP(HOST, self.port, local_hostname='localhost', timeout=3)
312 smtp.sendmail('John', 'Sally', m)
317 smtp.quit()
327 smtp = smtplib.SMTP(HOST, self.port, local_hostname='localhost', timeout=3)
328 smtp.sendmail('John', 'Sally', m)
331 smtp.quit()
342 smtp = smtplib.SMTP(HOST, self.port, local_hostname='localhost', timeout=3)
343 smtp.sendmail('John', 'Sally', m)
346 smtp.quit()
356 smtp = smtplib.SMTP(HOST, self.port, local_hostname='localhost', timeout=3)
357 smtp.sendmail('<>', 'Sally', m)
360 smtp.quit()
373 smtp = smtplib.SMTP(HOST, self.port, local_hostname='localhost', timeout=3)
374 smtp.send_message(m, from_addr='John', to_addrs='Sally')
377 smtp.quit()
397 smtp = smtplib.SMTP(HOST, self.port, local_hostname='localhost', timeout=3)
398 smtp.send_message(m)
401 smtp.quit()
430 smtp = smtplib.SMTP(HOST, self.port, local_hostname='localhost', timeout=3)
431 smtp.send_message(m)
434 smtp.quit()
457 smtp = smtplib.SMTP(HOST, self.port, local_hostname='localhost', timeout=3)
458 smtp.send_message(m, from_addr='joe@example.com', to_addrs='foo@example.net')
461 smtp.quit()
487 smtp = smtplib.SMTP(HOST, self.port, local_hostname='localhost', timeout=3)
488 smtp.send_message(m)
491 smtp.quit()
519 smtp = smtplib.SMTP(HOST, self.port, local_hostname='localhost', timeout=3)
520 smtp.send_message(m)
523 smtp.quit()
557 smtp = smtplib.SMTP(HOST, self.port, local_hostname='localhost', timeout=3)
559 smtp.send_message(m)
560 smtp.close()
569 smtp = smtplib.SMTP()
570 self.assertRaises(smtplib.SMTPServerDisconnected, smtp.ehlo)
572 smtp.send, 'test msg')
587 self.smtp = smtplib.SMTP()
588 self.smtp.ehlo = Mock(return_value=(200, 'OK'))
589 self.smtp.has_extn, self.smtp.sendmail = Mock(), Mock()
593 self.smtp.send_message(self.msg)
594 self.smtp.send_message(self.msg)
595 self.assertEqual(self.smtp.sendmail.call_args_list[0][0][3],
597 self.assertEqual(self.smtp.sendmail.call_args_list[1][0][3],
603 self.smtp.send_message(self.msg, None, None, mail_options)
605 self.assertEqual(self.smtp.sendmail.call_args_list[0][0][3],
906 smtp = smtplib.SMTP(HOST, self.port, local_hostname='localhost', timeout=15)
907 smtp.quit()
910 smtp = smtplib.SMTP(HOST, self.port, local_hostname='localhost', timeout=15)
913 self.assertEqual(smtp.esmtp_features, {})
923 smtp.ehlo()
924 self.assertEqual(smtp.esmtp_features, expected_features)
926 self.assertTrue(smtp.has_extn(k))
927 self.assertFalse(smtp.has_extn('unsupported-feature'))
928 smtp.quit()
931 smtp = smtplib.SMTP(HOST, self.port, local_hostname='localhost', timeout=15)
937 self.assertEqual(smtp.vrfy(addr_spec), expected_known)
941 self.assertEqual(smtp.vrfy(u), expected_unknown)
942 smtp.quit()
945 smtp = smtplib.SMTP(HOST, self.port, local_hostname='localhost', timeout=15)
952 self.assertEqual(smtp.expn(listname), expected_known)
956 self.assertEqual(smtp.expn(u), expected_unknown)
957 smtp.quit()
961 smtp = smtplib.SMTP(HOST, self.port, local_hostname='localhost', timeout=15)
962 resp = smtp.login(sim_auth[0], sim_auth[1])
964 smtp.close()
968 smtp = smtplib.SMTP(HOST, self.port, local_hostname='localhost', timeout=15)
969 resp = smtp.login(sim_auth[0], sim_auth[1])
971 smtp.close()
975 smtp = smtplib.SMTP(HOST, self.port, local_hostname='localhost', timeout=15)
976 resp = smtp.login(sim_auth[0], sim_auth[1])
978 smtp.close()
983 smtp = smtplib.SMTP(HOST, self.port, local_hostname='localhost', timeout=15)
984 resp = smtp.login(sim_auth[0], sim_auth[1])
986 smtp.close()
994 smtp = smtplib.SMTP(HOST, self.port,
996 smtp.ehlo('foo')
997 smtp.user, smtp.password = sim_auth[0], sim_auth[1]
999 resp = smtp.auth(mechanism, getattr(smtp, method))
1001 smtp.close()
1004 smtp = smtplib.SMTP(HOST, self.port,
1007 code, message = smtp.ehlo()
1009 self.assertIn('size', smtp.esmtp_features)
1010 smtp.quit()
1011 self.assertNotIn('size', smtp.esmtp_features)
1012 smtp.connect(HOST, self.port)
1013 self.assertNotIn('size', smtp.esmtp_features)
1014 smtp.ehlo_or_helo_if_needed()
1015 self.assertIn('size', smtp.esmtp_features)
1016 smtp.quit()
1019 with smtplib.SMTP(HOST, self.port) as smtp:
1020 code, message = smtp.noop()
1022 self.assertRaises(smtplib.SMTPServerDisconnected, smtp.send, b'foo')
1023 with smtplib.SMTP(HOST, self.port) as smtp:
1024 smtp.close()
1025 self.assertRaises(smtplib.SMTPServerDisconnected, smtp.send, b'foo')
1029 with smtplib.SMTP(HOST, self.port) as smtp:
1030 smtp.noop()
1040 smtp = smtplib.SMTP(HOST, self.port, local_hostname='localhost', timeout=15)
1041 smtp.noop()
1045 smtp.sendmail('John', 'Sally', 'test message')
1046 self.assertIsNone(smtp.sock)
1050 smtp = smtplib.SMTP(HOST, self.port, local_hostname='localhost', timeout=15)
1051 smtp.noop()
1054 smtp.sendmail('John', 'Sally', 'test message')
1055 self.assertIsNone(smtp.sock)
1059 smtp = smtplib.SMTP(HOST, self.port, local_hostname='localhost', timeout=15)
1060 smtp.noop()
1063 smtp.sendmail('John', ['Sally', 'Frank', 'George'], 'test message')
1064 self.assertIsNone(smtp.sock)
1076 smtp = smtplib.SMTP(HOST, self.port, local_hostname='localhost', timeout=15)
1077 smtp.noop()
1079 smtp.sendmail('John@foo.org', ['Sally@foo.org'], 'test message')
1080 self.assertIsNone(smtp.sock)
1084 smtp = smtplib.SMTP(
1086 self.addCleanup(smtp.close)
1087 smtp.ehlo()
1088 self.assertTrue(smtp.does_esmtp)
1089 self.assertFalse(smtp.has_extn('smtputf8'))
1092 smtp.sendmail,
1096 smtp.mail, 'John', options=['BODY=8BITMIME', 'SMTPUTF8'])
1099 smtp = smtplib.SMTP(
1101 self.addCleanup(smtp.close)
1102 self.assertRaises(UnicodeEncodeError, smtp.sendmail, 'Alice', 'Böb', '')
1103 self.assertRaises(UnicodeEncodeError, smtp.mail, 'Älice')
1112 smtp = smtplib.SMTP(
1114 self.addCleanup(smtp.close)
1116 smtp.send_message(msg)
1119 smtp = smtplib.SMTP(
1122 self.addCleanup(smtp.close)
1128 self.assertDictEqual(smtp.send_message(message), {})
1192 smtp = smtplib.SMTP(
1194 self.addCleanup(smtp.close)
1195 smtp.ehlo()
1196 self.assertTrue(smtp.does_esmtp)
1197 self.assertTrue(smtp.has_extn('smtputf8'))
1201 smtp = smtplib.SMTP(
1203 self.addCleanup(smtp.close)
1204 smtp.sendmail('Jőhn', 'Sálly', m,
1215 smtp = smtplib.SMTP(
1217 self.addCleanup(smtp.close)
1218 smtp.ehlo()
1220 smtp.mail('Jő', options=['BODY=8BITMIME', 'SMTPUTF8']),
1222 self.assertEqual(smtp.rcpt('János'), (250, b'OK'))
1223 self.assertEqual(smtp.data(m), (250, b'OK'))
1251 smtp = smtplib.SMTP(
1253 self.addCleanup(smtp.close)
1254 self.assertEqual(smtp.send_message(msg), {})
1313 smtp = smtplib.SMTP(HOST, self.port,
1315 smtp.login('psu', 'doesnotexist')
1316 smtp.close()
1320 smtp = smtplib.SMTP(HOST, self.port,
1322 smtp.user = 'psu'
1323 smtp.password = 'doesnotexist'
1324 code, response = smtp.auth('plain', smtp.auth_plain)
1325 smtp.close()