jetmore / swaks

Swaks - Swiss Army Knife for SMTP
http://jetmore.org/john/code/swaks/
GNU General Public License v2.0
848 stars 86 forks source link

Expand environment variables in config files #8

Open jetmore opened 4 years ago

jetmore commented 4 years ago

I'm not sure if this is a good idea, but someone tried it and found it didn't work. Noting it here for future consideration. Perhaps if it is added it should be off by default and turned on with --config-try-environment or something.

Repro:

mb 0 /Users/jetmore/Documents/git/swaks > cat config
--to $TO
--from from@example.com
--helo server.example.com
mb 0 /Users/jetmore/Documents/git/swaks > TO=recip@example.com ./swaks --dump protocol --config ./config
Protocol Info:
  protocol        = esmtp
  helo            = server.example.com
  from            = from@example.com
  to              = $TO
  force getpwuid  = FALSE
  quit after      =
  drop after      =
  drop after send =
  server_only     = FALSE
  timeout         = 30
  pipeline        = FALSE
  prdr            = FALSE
mb 0 /Users/jetmore/Documents/git/swaks >

If implemented, the "to" option in the output should show recip@example.com, not $TO