return htmlout
-def sendmail(mailbin, body, recipient, subject, *sender):
+def sendmail(mailbin, body, recipient, subject, html=True, sender=""):
logger.debug("Sending email")
- msg = MIMEText(body, 'html')
+ msg = MIMEText(body, 'html' if html else 'plain')
if sender:
msg["From"] = sender
msg["To"] = recipient
- msg["Content-type"] = "text/html: te: text/html"
+ msg["Content-type"] = "text/html: te: text/html" if html else "text/plain: te: text/plain"
msg["Subject"] = subject
mailproc = subprocess.Popen([mailbin, "--debug-level=" + str(10 if logging.root.level == logging.DEBUG else 0), "-t"], stdin=subprocess.PIPE, stdout=subprocess.PIPE)
logger.debug("Compiled message and opened process")