Menu

#9 [Feature] Get the first email address from virtusertable

open
nobody
None
5
2003-02-12
2003-02-12
Anonymous
No

def getSender(self, auth):
"return valid From-header"
import re
sender = auth.user.id
if "@" not in sender:
f = open("/etc/mail/virtusertable", "r")
for line in f.readlines():
m = re.search("^(.*)\s+%s$" %
sender, line)
if m:
sender = m.group(1)
break
else:
sender = "%s@%s" % (sender,
auth.user.domain)
if auth.user.name:
sender = '"%s" <%s>' % (auth.user.name,
sender)
return sender

Discussion


Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.