[Feature] Get the first email address from virtusertable
Status: Abandoned
Brought to you by:
henning
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