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

Last change on this file since 21:41e7bbc16e32 was 21:41e7bbc16e32, checked in by Borja Lopez <borja@…>, 13 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
Line 
1#!/usr/bin/env python
2#
3# Run the Mailjam MTA client
4
5import argparse, sys
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.