##// END OF EJS Templates
mail: properly handle email addresses typically being unicodes...
Augie Fackler -
r39066:2cf3bd4a default
parent child Browse files
Show More
@@ -152,8 +152,9 def _smtp(ui):
152 152 def _sendmail(ui, sender, recipients, msg):
153 153 '''send mail using sendmail.'''
154 154 program = ui.config('email', 'method')
155 cmdline = '%s -f %s %s' % (program, stringutil.email(sender),
156 ' '.join(map(stringutil.email, recipients)))
155 stremail = lambda x: stringutil.email(encoding.strtolocal(x))
156 cmdline = '%s -f %s %s' % (program, stremail(sender),
157 ' '.join(map(stremail, recipients)))
157 158 ui.note(_('sending mail: %s\n') % cmdline)
158 159 fp = procutil.popen(cmdline, 'wb')
159 160 fp.write(util.tonativeeol(msg))
@@ -169,7 +170,8 def _mbox(mbox, sender, recipients, msg)
169 170 # Should be time.asctime(), but Windows prints 2-characters day
170 171 # of month instead of one. Make them print the same thing.
171 172 date = time.strftime(r'%a %b %d %H:%M:%S %Y', time.localtime())
172 fp.write('From %s %s\n' % (sender, date))
173 fp.write('From %s %s\n' % (encoding.strtolocal(sender),
174 encoding.strtolocal(date)))
173 175 fp.write(msg)
174 176 fp.write('\n\n')
175 177 fp.close()
General Comments 0
You need to be logged in to leave comments. Login now