source: mailjam/bin/mailjam-mta@ 21:41e7bbc16e32

Last change on this file since 21:41e7bbc16e32 was 21:41e7bbc16e32, checked in by Borja Lopez <borja@…>, 12 years ago

Improved the mailjam-mta and mailjam-server scripts, adding argparse
definitions for the proper parameters available for both scripts.

  • Property exe set to *
File size: 1.2 KB
RevLine 
[15]1#!/usr/bin/env python
2#
[21]3# Run the Mailjam MTA client
[15]4
[21]5import argparse, sys
6from mailjam.mta import MTAClient
[15]7
[21]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')
[15]17
[21]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")
[15]21
22if __name__ == '__main__':
[21]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())
[15]30 mta_client.run()
31
Note: See TracBrowser for help on using the repository browser.