STD_HEADERS = ('From', 'To', 'Cc', 'Bcc', 'Subject', 'Reply-To', 'In-Reply-To')
KEEP_HEADERS = { 'KEEP_FROM_HEADER' : STD_HEADERS[:1]
, 'KEEP_STD_HEADERS' : STD_HEADERS[1:]
+ , 'KEEP_ALL_HEADERS' : STD_HEADERS
}
SIG_DELIM='\n-- \n'
if not os.path.exists(CONFFILE):
# conffile does not exist, let's create it with defaults.
+ options.verbose = True
if not os.path.isdir(MAILPLATEDIR):
info('configuration directory not found, creating: ' + MAILPLATEDIR)
sys.exit(posix.EX_USAGE)
elif not templname and not (options.auto or options.menu):
- err('no template specified')
- sys.exit(posix.EX_USAGE)
+ if default_templname is not None:
+ templname = default_templname
+ else:
+ err('no template specified')
+ sys.exit(posix.EX_USAGE)
elif options.menu:
err('--menu mode not yet implemented')
l = line[:-1]
if len(l) == 0:
payload = '' # end of headers
- elif l[0] == KEEP_SLOT_LEADER and KEEP_HEADERS.has_key(l[1:]):
- # found predefined header slot keyword
- for header in KEEP_HEADERS[l[1:]]:
- headers[header.lower()] = (header, _keep_header)
+ elif l[0] == KEEP_SLOT_LEADER:
+ if KEEP_HEADERS.has_key(l[1:]):
+ # found predefined header slot keyword
+ for header in KEEP_HEADERS[l[1:]]:
+ headers[header.lower()] = (header, _keep_header)
+ else:
+ err('unknown header slot ' + l + ' found')
+ sys.exit(posix.EX_CONFIG)
else:
header, content = l.split(':', 1)
content = content.strip()
sys.exit(posix.EX_USAGE)
os.execlp('sensible-editor', 'sensible-editor', outfname)
+