{"thread":{"id":"9415","subject":"[PATCH] Ask for SMTP password if it's not provided","startedAt":"2007-08-07T02:16:15Z","lastAt":"2007-08-07T02:16:15Z","messageCount":1,"participants":["Pavel Roskin"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"50069","messageId":"20070807021614.21226.13314.stgit@gx.roinet.com","threadId":"9415","inReplyTo":null,"subject":"[PATCH] Ask for SMTP password if it's not provided","fromName":"Pavel Roskin","fromEmail":"proski@gnu.org","sentAt":"2007-08-07T02:16:15Z","receivedAt":"2007-08-07T02:16:15Z","isPatch":true,"sender":{"key":"proski@gnu.org","avatar":null},"body":"Mention this in examples/gitconfig, explain SMTP options in more detail.\n\nSigned-off-by: Pavel Roskin <proski@gnu.org>\n---\n\n examples/gitconfig     |    9 ++++++++-\n stgit/commands/mail.py |    6 +++---\n 2 files changed, 11 insertions(+), 4 deletions(-)\n\ndiff --git a/examples/gitconfig b/examples/gitconfig\nindex 3abbe6a..e402208 100644\n--- a/examples/gitconfig\n+++ b/examples/gitconfig\n@@ -18,10 +18,17 @@\n \t# 'refresh' will automatically mark the conflicts as resolved\n \t#autoresolved = no\n \n+\t# SMTP server for sending patches\n \t#smtpserver = localhost:25\n+\n+\t# Set to 'yes' to use SMTP over TLS\n+\t#smtptls = no\n+\n+\t# Username for SMTP authentication, required if TLS is used\n \t#smtpuser = username\n+\n+\t# Password for SMTP.  If not provided, it will be asked\n \t#smtppassword = password\n-\t#smtptls = no\n \n \t# delay between messages in seconds (defaults to 5)\n \t#smtpdelay = 5\ndiff --git a/stgit/commands/mail.py b/stgit/commands/mail.py\nindex 7ed5c27..69712cb 100644\n--- a/stgit/commands/mail.py\n+++ b/stgit/commands/mail.py\n@@ -15,7 +15,7 @@ along with this program; if not, write to the Free Software\n Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA\n \"\"\"\n \n-import sys, os, re, time, datetime, socket, smtplib\n+import sys, os, re, time, datetime, socket, smtplib, getpass\n import email, email.Utils, email.Header\n from optparse import OptionParser, make_option\n \n@@ -492,10 +492,10 @@ def func(parser, options, args):\n \n     if (smtppassword and not smtpuser):\n         raise CmdException, 'SMTP password supplied, username needed'\n-    if (smtpuser and not smtppassword):\n-        raise CmdException, 'SMTP username supplied, password needed'\n     if (smtpusetls and not smtpuser):\n         raise CmdException, 'SMTP over TLS requested, username needed'\n+    if (smtpuser and not smtppassword):\n+        smtppassword = getpass.getpass(\"Please enter SMTP password: \")\n \n     total_nr = len(patches)\n     if total_nr == 0:\n"}]}