#7484: no more <> around addresses in VRFY or EXPN
The RFC doesn't say that they are allowed; apparently many mailers accept
them, but not postfix. Contributions to this patch were made by Felipe Cruz
and Catalin Iacob.
diff --git a/Lib/test/test_smtplib.py b/Lib/test/test_smtplib.py
index 42a10be..81806c9 100644
--- a/Lib/test/test_smtplib.py
+++ b/Lib/test/test_smtplib.py
@@ -330,15 +330,14 @@
self.push(resp)
def smtp_VRFY(self, arg):
- raw_addr = email.utils.parseaddr(arg)[1]
- quoted_addr = smtplib.quoteaddr(arg)
- if raw_addr in sim_users:
- self.push('250 %s %s' % (sim_users[raw_addr], quoted_addr))
+ # For max compatibility smtplib should be sending the raw address.
+ if arg in sim_users:
+ self.push('250 %s %s' % (sim_users[arg], smtplib.quoteaddr(arg)))
else:
self.push('550 No such user: %s' % arg)
def smtp_EXPN(self, arg):
- list_name = email.utils.parseaddr(arg)[1].lower()
+ list_name = arg.lower()
if list_name in sim_lists:
user_list = sim_lists[list_name]
for n, user_email in enumerate(user_list):
@@ -454,7 +453,7 @@
self.assertEqual(smtp.vrfy(email), expected_known)
u = 'nobody@nowhere.com'
- expected_unknown = (550, 'No such user: %s' % smtplib.quoteaddr(u))
+ expected_unknown = (550, 'No such user: %s' % u)
self.assertEqual(smtp.vrfy(u), expected_unknown)
smtp.quit()