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

honour ~/.netrc #5

Closed fany closed 4 years ago

fany commented 4 years ago

Currently, one of my use cases for swaks is a simple monitoring cronjob including the requirement for authentication. For security reasons, I do not want to put the password on the command line, but obviously it is no alternative to be prompted for it either.

Therefore I have extended swaks so that it will try to obtain the login credentials from my ~/.netrc using the standard Net::Netrc module if authentication is required but no username and/or password is given. You may still turn this off by supplying -au respectively -ap without an argument.

jetmore commented 4 years ago

In base.pod, please update the doc for --auth-user and --auth-password with the following:

=item -au, --auth-user [username]

Provide the username to be used for authentication.  If no username is provided, indicate that Swaks should attempt to find the username via .netrc (requires the Net::Netrc module).  If no username is provided and cannot be found via .netrc,  the user will be prompted to provide one.  The string E<lt>E<gt> can be supplied to mean an empty username.

=item -ap, --auth-password [password]

Provide the password to be used for authentication. If no password is provided, indicate that Swaks should attempt to find the password via .netrc (requires the Net::Netrc module).  If no password is provided and cannot be found via .netrc,  the user will be prompted to provide one.  The string E<lt>E<gt> can be supplied to mean an empty password.
jetmore commented 4 years ago

Please update Changes file to include a record for the change you made. Include your initials or github username if you want. Thanks for being my first PR, helping me put together a contributors doc in my head

fany commented 4 years ago

Hi @jetmore ,

thanks for your comments! I've included the amendments you demanded in a second commit to this branch.

Regards fany

jetmore commented 4 years ago

Thanks for the patch, Martin. Glad it's finally in (it's only been since 2014, yeah?)