Browse files

Updated pyami_sendmail to offer more options, including HTML formatting

email and not appending the instance id
  • Loading branch information...
kopertop committed Jul 15, 2011
1 parent 59d6976 commit 29b4161b498117c625fdeb2784db2adfaeeebb3f
Showing with 6 additions and 1 deletion.
  1. +6 −1 bin/pyami_sendmail
@@ -37,11 +37,16 @@ if __name__ == "__main__":
parser.add_option("-t", "--to", help="Optional to address to send to (default from your boto.cfg)", action="store", default=None, dest="to")
parser.add_option("-s", "--subject", help="Optional Subject to send this report as", action="store", default="Report", dest="subject")
parser.add_option("-f", "--file", help="Optionally, read from a file instead of STDIN", action="store", default=None, dest="file")
+ parser.add_option("--html", help="HTML Format the email", action="store_true", default=False, dest="html")
+ parser.add_option("--no-instance-id", help="If set, don't append the instance id", action="store_false", default=True, dest="append_instance_id")
(options, args) = parser.parse_args()
if options.file:
body = open(options.file, 'r').read()
body =
- notify(options.subject, body=body,
+ if options.html:
+ notify(options.subject, html_body=body,, append_instance_id=options.append_instance_id)
+ else:
+ notify(options.subject, body=body,, append_instance_id=options.append_instance_id)

0 comments on commit 29b4161

Please sign in to comment.