306
306
return commandline
309
class EmacsMailMode(ExternalMailClient):
310
"""Call emacsclient in mail-mode.
312
This only work for emacs >= 22.1.
314
_client_commands = ['emacsclient']
316
def _get_compose_commandline(self, to, subject, attach_path):
317
commandline = ["--eval"]
318
# Ensure we can at least have an empty mail-mode buffer
323
_to = ("\"%s\"" % self._encode_safe(to))
324
if subject is not None:
325
_subject = ("\"%s\"" % self._encode_safe(subject))
326
mmform = "(mail nil %s %s)" % (_to ,_subject)
328
# call mail-mode, move the point to body and insert a new blank line
329
# we *must* force this point movement for the case when To is not passed
330
# with --mail-to. Without this, the patch could be inserted at the wrong place
331
commandline.append(mmform)
332
commandline.append("(mail-text)")
333
commandline.append("(newline)")
335
# ... and put a MIME attachment (if any)
336
if attach_path is not None:
337
ifform = "(attach \"%s\")" % self._encode_path(attach_path,'attachment')
338
commandline.append(ifform)
309
342
class MAPIClient(ExternalMailClient):
310
343
"""Default Windows mail client launched using MAPI."""