Skip to content

Commit 29b4161

Browse files
committed
Updated pyami_sendmail to offer more options, including HTML formatting
email and not appending the instance id
1 parent 59d6976 commit 29b4161

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

bin/pyami_sendmail

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,11 +37,16 @@ if __name__ == "__main__":
3737
parser.add_option("-t", "--to", help="Optional to address to send to (default from your boto.cfg)", action="store", default=None, dest="to")
3838
parser.add_option("-s", "--subject", help="Optional Subject to send this report as", action="store", default="Report", dest="subject")
3939
parser.add_option("-f", "--file", help="Optionally, read from a file instead of STDIN", action="store", default=None, dest="file")
40+
parser.add_option("--html", help="HTML Format the email", action="store_true", default=False, dest="html")
41+
parser.add_option("--no-instance-id", help="If set, don't append the instance id", action="store_false", default=True, dest="append_instance_id")
4042

4143
(options, args) = parser.parse_args()
4244
if options.file:
4345
body = open(options.file, 'r').read()
4446
else:
4547
body = sys.stdin.read()
4648

47-
notify(options.subject, body=body, to_string=options.to)
49+
if options.html:
50+
notify(options.subject, html_body=body, to_string=options.to, append_instance_id=options.append_instance_id)
51+
else:
52+
notify(options.subject, body=body, to_string=options.to, append_instance_id=options.append_instance_id)

0 commit comments

Comments
 (0)