Changeset 406 for foomailer/foomail.py


Ignore:
Timestamp:
Jun 29, 2020, 7:26:57 PM (4 years ago)
Author:
Rick van der Zwet
Message:

foomailer: Add SSL & auth support

File:
1 edited

Legend:

Unmodified
Added
Removed
  • foomailer/foomail.py

    r405 r406  
    4040parser.add_argument('--recipient', '-r', required=True)
    4141parser.add_argument('--server', '-s', required=True)
     42parser.add_argument('--auth', help="SMTP AUTH username:password")
    4243parser.add_argument('--cc', help='Carbon Copy header')
    4344parser.add_argument('--file', action='append', help='Attachments to sent')
     
    4647parser.add_argument('--subject', default=default_subject, help='Alternative Subject header')
    4748parser.add_argument('--spam', action='store_true', help='Include X-Spam testing headers')
     49parser.add_argument('--ssl', action='store_true', help='Put SMTP connect in TLS mode')
    4850parser.add_argument('--port', type=int, default=25, help='SMTP port used for connection')
    4951parser.add_argument('--reply-to', help='Set Reply-To: header')
     
    142144    server.helo(args.hostname)
    143145    server.ehlo(args.hostname)
     146    if args.ssl:
     147        server.starttls()
     148    if args.auth:
     149        user, password = args.auth.split(':', 1)
     150        server.login(user, password)
    144151    server.sendmail(args.sender, args.recipient, email.as_string())
    145152    server.quit()
Note: See TracChangeset for help on using the changeset viewer.