{"thread":{"id":"9445","subject":"[StGIT PATCH] Add an --smtp-server commandline option to \"stg add\"","startedAt":"2007-08-08T22:11:09Z","lastAt":"2007-08-08T22:11:09Z","messageCount":1,"participants":["Karl Hasselström"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"50250","messageId":"20070808221002.13517.66699.stgit@yoghurt","threadId":"9445","inReplyTo":null,"subject":"[StGIT PATCH] Add an --smtp-server commandline option to \"stg add\"","fromName":"Karl Hasselström","fromEmail":"kha@treskal.com","sentAt":"2007-08-08T22:11:09Z","receivedAt":"2007-08-08T22:11:09Z","isPatch":true,"sender":{"key":"kha@treskal.com","avatar":"https://gravatar.com/avatar/f0120c734b5279b345075a28521e1ac66acb20c9913ffe9bf6ae97e53f7f3f13?d=mp&s=160"},"body":"The configuration option stgit.smtpserver is useful if you always talk\nto the same SMTP server. But I usually set up a temporary ssh tunnel,\nso I'd rather have a commandline option.\n\nSigned-off-by: Karl Hasselström <kha@treskal.com>\n\n---\n\nThis patch is sent using the --smtp-server commandline option. Pure\nmagic!\n\n stgit/commands/mail.py |   13 ++++++++-----\n 1 files changed, 8 insertions(+), 5 deletions(-)\n\ndiff --git a/stgit/commands/mail.py b/stgit/commands/mail.py\nindex cb8dc74..a7f7151 100644\n--- a/stgit/commands/mail.py\n+++ b/stgit/commands/mail.py\n@@ -28,10 +28,11 @@ from stgit.config import config\n help = 'send a patch or series of patches by e-mail'\n usage = \"\"\"%prog [options] [<patch1>] [<patch2>] [<patch3>..<patch4>]\n \n-Send a patch or a range of patches by e-mail using the 'smtpserver'\n-configuration option. The From address and the e-mail format are\n-generated from the template file passed as argument to '--template'\n-(defaulting to '.git/patchmail.tmpl' or\n+Send a patch or a range of patches by e-mail using the SMTP server\n+specified by the 'stgit.smtpserver' configuration option, or the\n+'--smtp-server' command line option. The From address and the e-mail\n+format are generated from the template file passed as argument to\n+'--template' (defaulting to '.git/patchmail.tmpl' or\n '~/.stgit/templates/patchmail.tmpl' or\n '/usr/share/stgit/templates/patchmail.tmpl').\n \n@@ -117,6 +118,8 @@ options = [make_option('-a', '--all',\n                        help = 'sleep for SECONDS between e-mails sending'),\n            make_option('--refid',\n                        help = 'use REFID as the reference id'),\n+           make_option('--smtp-server', metavar = 'HOST[:PORT]',\n+                       help = 'SMTP server to use for sending mail'),\n            make_option('-u', '--smtp-user', metavar = 'USER',\n                        help = 'username for SMTP authentication'),\n            make_option('-p', '--smtp-password', metavar = 'PASSWORD',\n@@ -465,7 +468,7 @@ def func(parser, options, args):\n     \"\"\"Send the patches by e-mail using the patchmail.tmpl file as\n     a template\n     \"\"\"\n-    smtpserver = config.get('stgit.smtpserver')\n+    smtpserver = options.smtp_server or config.get('stgit.smtpserver')\n \n     applied = crt_series.get_applied()\n \n"}]}