summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
509ea33)
- fix to keep it from catching the message in quoted text
- safer working with sendmail
# list of regular expressions which we will view as being indicative
# of an attachment
attachment_regexes = [ r'\battach(ed|ment|ing)?\b(?im)',
# list of regular expressions which we will view as being indicative
# of an attachment
attachment_regexes = [ r'\battach(ed|ment|ing)?\b(?im)',
- r'\balleg(o|at[oaie]|ando)' ]
+ r'\balleg(o|at[oaie]|ando)(?im)' ]
+# ignore quoted text (which might refer to attachments in previous emails)
+attachment_regexes = [ r'(^|^[^\n>].*)' + x for x in attachment_regexes ]
### No Edit Below This Line
###########################################
### No Edit Below This Line
###########################################
def send_message():
global sendmail
def send_message():
global sendmail
- sendmail = sendmail + " " + " ".join( sys.argv[1:] )
-
- mailpipe = os.popen("%s" % sendmail, 'w')
+
+ # construct the sendmail pipe more safely (thanks iain murray!)
+ cmd = sys.argv[:]
+ cmd[0] = sendmail
+
+ from subprocess import Popen, PIPE
+ mailpipe = Popen(cmd, stdin=PIPE).stdin
mailpipe.write( message_string )
sys.exit( mailpipe.close() )
mailpipe.write( message_string )
sys.exit( mailpipe.close() )