source: mailjam/bin/mailjam-mta@ 28:78868a27630e

Last change on this file since 28:78868a27630e was 23:adc5b22efd7e, checked in by Borja Lopez <borja@…>, 13 years ago

Added the first version of the CLI client, which implements a shell-like
interface where users can interact with a mailjam server.

This first versions adds no "big" features, but contains the basis to build
a complete shell interface (including history saving support, completion,
help for commands, etc)

Added a custom configuration file (conf/mailjam-cli.conf) for the CLI
client.

Added a new mailjam.config class (CLIClientConfig) that is used by the CLI
client to load its configuration file.

Updated the package information (setup.py, MANIFEST) to include the CLI
client data.

Modified the behaviour of the XMLRPC methods registered in the *XMLRPC classes
within the daemon module. Now instead of raising exceptions directly, they
catch such exceptions, returning only a string representation of the error
to the XMLRPC client. If there is no error, a nice "ok" message is returned.

  • Property exe set to *
File size: 1.2 KB
Line 
1#!/usr/bin/env python
2#
3# Run the Mailjam MTA client
4
5import argparse
6from mailjam.mta import MTAClient
7
8msg = 'mailjam-mta: Mailing lists MTA client'
9parser = argparse.ArgumentParser(description=msg)
10parser.add_argument('-c', '--config', action='store', dest='config',
11 help='Set the path to a valid mailjam mta client configuration file')
12parser.add_argument('-v', '--version', action='version',
13 version='mailjam mta client 0.1.0')
14parser.add_argument('-a', '--address', action='store', dest='address',
15 required=True,
16 help='Set the address of the mailing list we want to manage')
17
18parser.add_argument('-i', '--input', type=argparse.FileType('r'),
19 default='-', required=True, dest='input',
20 help="Pass the raw email to be send to the mailing list, Use - to allow incoming raw mails from a pipe")
21
22if __name__ == '__main__':
23 results = parser.parse_args()
24 if results.config:
25 mta_client = MTAClient(address=results.address,
26 configfile=results.config)
27 else:
28 mta_client = MTAClient(address=results.address)
29 mta_client.get_raw_email(results.input.read())
30 mta_client.run()
31
Note: See TracBrowser for help on using the repository browser.