Show More
@@ -28,9 +28,6 from typing import ( | |||||
28 | ) |
|
28 | ) | |
29 |
|
29 | |||
30 | from .i18n import _ |
|
30 | from .i18n import _ | |
31 | from .pycompat import ( |
|
|||
32 | open, |
|
|||
33 | ) |
|
|||
34 | from . import ( |
|
31 | from . import ( | |
35 | encoding, |
|
32 | encoding, | |
36 | error, |
|
33 | error, | |
@@ -221,7 +218,7 def _sendmail(ui, sender, recipients, ms | |||||
221 | def _mbox(mbox, sender, recipients, msg): |
|
218 | def _mbox(mbox, sender, recipients, msg): | |
222 | '''write mails to mbox''' |
|
219 | '''write mails to mbox''' | |
223 | # TODO: use python mbox library for proper locking |
|
220 | # TODO: use python mbox library for proper locking | |
224 |
with open(mbox, |
|
221 | with open(mbox, 'ab+') as fp: | |
225 | # Should be time.asctime(), but Windows prints 2-characters day |
|
222 | # Should be time.asctime(), but Windows prints 2-characters day | |
226 | # of month instead of one. Make them print the same thing. |
|
223 | # of month instead of one. Make them print the same thing. | |
227 | date = time.strftime('%a %b %d %H:%M:%S %Y', time.localtime()) |
|
224 | date = time.strftime('%a %b %d %H:%M:%S %Y', time.localtime()) | |
@@ -237,7 +234,7 def connect(ui, mbox=None): | |||||
237 | """make a mail connection. return a function to send mail. |
|
234 | """make a mail connection. return a function to send mail. | |
238 | call as sendmail(sender, list-of-recipients, msg).""" |
|
235 | call as sendmail(sender, list-of-recipients, msg).""" | |
239 | if mbox: |
|
236 | if mbox: | |
240 |
open(mbox, |
|
237 | open(mbox, 'wb').close() | |
241 | return lambda s, r, m: _mbox(mbox, s, r, m) |
|
238 | return lambda s, r, m: _mbox(mbox, s, r, m) | |
242 | if ui.config(b'email', b'method') == b'smtp': |
|
239 | if ui.config(b'email', b'method') == b'smtp': | |
243 | return _smtp(ui) |
|
240 | return _smtp(ui) |
General Comments 0
You need to be logged in to leave comments.
Login now