331
331
class Claws(ExternalMailClient):
332
332
"""Claws mail client."""
334
336
_client_commands = ['claws-mail']
336
def _get_compose_commandline(self, to, subject, attach_path):
338
def _get_compose_commandline(self, to, subject, attach_path, body=None):
337
339
"""See ExternalMailClient._get_compose_commandline"""
338
compose_url = ['mailto:']
340
compose_url.append(self._encode_safe(to))
341
compose_url.append('?')
341
email = self.config.get_user_option('email')
342
if email is not None:
343
compose_url.append('from=' + urllib.quote(email))
342
344
if subject is not None:
343
345
# Don't use urllib.quote_plus because Claws doesn't seem
344
346
# to recognise spaces encoded as "+".
345
347
compose_url.append(
346
'subject=%s' % urllib.quote(self._encode_safe(subject)))
348
'subject=' + urllib.quote(self._encode_safe(subject)))
351
'body=' + urllib.quote(self._encode_safe(body)))
352
# to must be supplied for the claws-mail --compose syntax to work.
354
raise errors.NoMailAddressSpecified()
355
compose_url = 'mailto:%s?%s' % (
356
self._encode_safe(to), '&'.join(compose_url))
347
357
# Collect command-line options.
348
message_options = ['--compose', ''.join(compose_url)]
358
message_options = ['--compose', compose_url]
349
359
if attach_path is not None:
350
360
message_options.extend(
351
361
['--attach', self._encode_path(attach_path, 'attachment')])