| Line |   | 
|---|
| 1 | #!/usr/bin/env python
 | 
|---|
| 2 | #
 | 
|---|
| 3 | # Run the Postman MTA client
 | 
|---|
| 4 | 
 | 
|---|
| 5 | import sys
 | 
|---|
| 6 | from postman.mta import MTAClient
 | 
|---|
| 7 | 
 | 
|---|
| 8 | def usage():
 | 
|---|
| 9 |     print """
 | 
|---|
| 10 |     Usage: postman-mta address < raw_email_data
 | 
|---|
| 11 | 
 | 
|---|
| 12 |     address is a valid mailing list address
 | 
|---|
| 13 | 
 | 
|---|
| 14 |     raw_email_data is the raw data (txt) that contains the information of
 | 
|---|
| 15 |     the email to be sent
 | 
|---|
| 16 |     """
 | 
|---|
| 17 |     return True
 | 
|---|
| 18 | 
 | 
|---|
| 19 | if __name__ == '__main__':
 | 
|---|
| 20 |     if len(sys.argv) < 2:
 | 
|---|
| 21 |         usage()
 | 
|---|
| 22 |         raise SystemExit
 | 
|---|
| 23 |     try:
 | 
|---|
| 24 |         raw_email = sys.stdin.read()
 | 
|---|
| 25 |     except:
 | 
|---|
| 26 |         usage()
 | 
|---|
| 27 |         raise SystemExit
 | 
|---|
| 28 |     mta_client = MTAClient(address=sys.argv[1])
 | 
|---|
| 29 |     mta_client.get_raw_email(raw_email)
 | 
|---|
| 30 |     mta_client.run()
 | 
|---|
| 31 | 
 | 
|---|
       
      
  Note:
 See   
TracBrowser
 for help on using the repository browser.