git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Pavel Roskin <proski@gnu.org>
To: Catalin Marinas <catalin.marinas@gmail.com>, git@vger.kernel.org
Subject: [PATCH] Ask for SMTP password if it's not provided
Date: Mon, 06 Aug 2007 22:16:15 -0400	[thread overview]
Message-ID: <20070807021614.21226.13314.stgit@gx.roinet.com> (raw)

Mention this in examples/gitconfig, explain SMTP options in more detail.

Signed-off-by: Pavel Roskin <proski@gnu.org>
---

 examples/gitconfig     |    9 ++++++++-
 stgit/commands/mail.py |    6 +++---
 2 files changed, 11 insertions(+), 4 deletions(-)

diff --git a/examples/gitconfig b/examples/gitconfig
index 3abbe6a..e402208 100644
--- a/examples/gitconfig
+++ b/examples/gitconfig
@@ -18,10 +18,17 @@
 	# 'refresh' will automatically mark the conflicts as resolved
 	#autoresolved = no
 
+	# SMTP server for sending patches
 	#smtpserver = localhost:25
+
+	# Set to 'yes' to use SMTP over TLS
+	#smtptls = no
+
+	# Username for SMTP authentication, required if TLS is used
 	#smtpuser = username
+
+	# Password for SMTP.  If not provided, it will be asked
 	#smtppassword = password
-	#smtptls = no
 
 	# delay between messages in seconds (defaults to 5)
 	#smtpdelay = 5
diff --git a/stgit/commands/mail.py b/stgit/commands/mail.py
index 7ed5c27..69712cb 100644
--- a/stgit/commands/mail.py
+++ b/stgit/commands/mail.py
@@ -15,7 +15,7 @@ along with this program; if not, write to the Free Software
 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
 """
 
-import sys, os, re, time, datetime, socket, smtplib
+import sys, os, re, time, datetime, socket, smtplib, getpass
 import email, email.Utils, email.Header
 from optparse import OptionParser, make_option
 
@@ -492,10 +492,10 @@ def func(parser, options, args):
 
     if (smtppassword and not smtpuser):
         raise CmdException, 'SMTP password supplied, username needed'
-    if (smtpuser and not smtppassword):
-        raise CmdException, 'SMTP username supplied, password needed'
     if (smtpusetls and not smtpuser):
         raise CmdException, 'SMTP over TLS requested, username needed'
+    if (smtpuser and not smtppassword):
+        smtppassword = getpass.getpass("Please enter SMTP password: ")
 
     total_nr = len(patches)
     if total_nr == 0:

                 reply	other threads:[~2007-08-07  2:16 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20070807021614.21226.13314.stgit@gx.roinet.com \
    --to=proski@gnu.org \
    --cc=catalin.marinas@gmail.com \
    --cc=git@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).