|
From: <di...@us...> - 2007-01-27 17:10:04
|
Revision: 318
http://safekeep.svn.sourceforge.net/safekeep/?rev=318&view=rev
Author: dimi
Date: 2007-01-27 09:09:58 -0800 (Sat, 27 Jan 2007)
Log Message:
-----------
Use sendmail is no SMTP server is specified.
Modified Paths:
--------------
safekeep/trunk/doc/safekeep.txt
safekeep/trunk/safekeep
Modified: safekeep/trunk/doc/safekeep.txt
===================================================================
--- safekeep/trunk/doc/safekeep.txt 2007-01-26 23:25:37 UTC (rev 317)
+++ safekeep/trunk/doc/safekeep.txt 2007-01-27 17:09:58 UTC (rev 318)
@@ -99,7 +99,7 @@
-m, --smtp=SMTP::
Specifies the SMTP server used for sending
- mails when `-e` is used. Defaults to `localhost`.
+ mails when `-e` is used. Defaults to using `/usr/sbin/sendmail`.
KEYS OPTIONS
------------
Modified: safekeep/trunk/safekeep
===================================================================
--- safekeep/trunk/safekeep 2007-01-26 23:25:37 UTC (rev 317)
+++ safekeep/trunk/safekeep 2007-01-27 17:09:58 UTC (rev 318)
@@ -84,11 +84,19 @@
hostname = socket.gethostname()
msg = 'From: SafeKeep@' + hostname + \
'\r\nTo: ' + ', '.join(email) + \
- '\r\nSubject: SafeKeep results on ' + hostname + \
- '\r\n\r\n' + '\n'.join(logbuf)
- server = smtplib.SMTP(smtp)
- server.sendmail('SafeKeep@' + hostname, email, msg)
- server.quit()
+ '\r\nSubject: SafeKeep results for ' + hostname + \
+ '\r\n\r\n' + '\r\n'.join(logbuf)
+ if smtp:
+ server = smtplib.SMTP(smtp)
+ server.sendmail('SafeKeep@' + hostname, email, msg)
+ server.quit()
+ else:
+ cmd = '/usr/sbin/sendmail -t'
+ pin = os.popen(cmd, 'w')
+ try:
+ pin.write(msg)
+ finally:
+ pin.close()
def is_temp_root(dir):
return dir != '/'
@@ -758,7 +766,7 @@
print 'server options:'
print '-c, --conf=FILE|DIR use the given configuration file/directory'
print '-e, --email=EMAIL send results by email (can appear multiple times)'
- print '-m, --smtp=SMTP SMTP server to use when sending mails (default: built-in SMTP)'
+ print '-m, --smtp=SMTP SMTP server to use when sending mails (default: sendmail)'
if exitcode is not None: sys.exit(exitcode)
def main():
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|