On 29 October 2002, I said:
> While I'm in the mood, here's another patch for syncmail. This one
> fixes bug #592836
Here's a revised version of that patch, relative to current CVS:
--- syncmail 7 Nov 2002 15:02:10 -0000 1.22
+++ syncmail 7 Nov 2002 15:04:36 -0000
@@ -219,6 +219,16 @@
+rfc822_specials_re = re.compile(r'[\(\)\<\>\@\,\;\:\\\"\.\[\]]')
+
+def quotename(name):
+ if name and rfc822_specials_re.search(name):
+ return '"%s"' % name.replace('"', '\\"')
+ else:
+ return name
+
+
+
def blast_mail(subject, people, filestodiff, contextlines, fromhost, replyto):
# cannot wait for child process or that will cause parent to retain cvs
# lock for too long. Urg!
@@ -237,13 +247,13 @@
sys.stdout = s
try:
vars = {'address' : address,
- 'name' : name,
+ 'name' : quotename(name),
'people' : string.join(people, COMMASPACE),
'subject' : subject,
'version' : __version__,
}
print '''\
-From: "%(name)s" <%(address)s>
+From: %(name)s <%(address)s>
To: %(people)s''' % vars
if replyto:
print 'Reply-To: %s' % replyto
Barry already said +1 for this, so I'm going to test it out in real life
and then check this change in.
Greg
--
Greg Ward <gw...@py...> http://www.gerg.ca/
I don't believe there really IS a GAS SHORTAGE.. I think it's all just
a BIG HOAX on the part of the plastic sign salesmen -- to sell more numbers!!
|