MCPcopy Create free account
hub / github.com/RT-Thread/env-windows / quoteaddr

Function quoteaddr

tools/python-3.11.9-amd64/Lib/smtplib.py:146–157  ·  view source on GitHub ↗

Quote a subset of the email addresses defined by RFC 821. Should be able to handle anything email.utils.parseaddr can handle.

(addrstring)

Source from the content-addressed store, hash-verified

144 """
145
146def quoteaddr(addrstring):
147 """Quote a subset of the email addresses defined by RFC 821.
148
149 Should be able to handle anything email.utils.parseaddr can handle.
150 """
151 displayname, addr = email.utils.parseaddr(addrstring)
152 if (displayname, addr) == ('', ''):
153 # parseaddr couldn't parse it, use it as is and hope for the best.
154 if addrstring.strip().startswith('<'):
155 return addrstring
156 return "<%s>" % addrstring
157 return "<%s>" % addr
158
159def _addr_only(addrstring):
160 displayname, addr = email.utils.parseaddr(addrstring)

Callers 2

mailMethod · 0.85
rcptMethod · 0.85

Calls 2

startswithMethod · 0.80
stripMethod · 0.80

Tested by

no test coverage detected