+FROM="monitor@planet-lab.org"
+
+def reformat_for_rt(text):
+ lines = text.split("\n")
+ spaced_text = ""
+ for line in lines:
+ spaced_text += " %s\n" %line
+ return spaced_text
+
+
+def emailViaRT(subject, text, to):
+ """Use RT command line tools to send email.
+ return the generated RT ticket ID number.
+ """
+ i_ticket = 0
+
+ if config.mail and config.debug:
+ to = [config.email]
+
+ os.environ['PATH'] = os.environ['PATH'] + ":/home/soltesz/rpm/opt/rt3/bin/"
+ os.environ['RTSERVER'] = "https://rt.planet-lab.org/"
+ os.environ['RTUSER'] = "monitor"
+ os.environ['RTPASSWD'] = "ssorcmor"
+ os.environ['RTDEBUG'] = "0"
+ # NOTE: AdminCc: (in PLC's RT configuration) gets an email sent.
+ # This is not the case (surprisingly) for Cc:
+ input_text = "Subject: %s\n"
+ input_text += "Requestor: monitor@planet-lab.org\n"
+ input_text += "id: ticket/new\n"
+ input_text += "Queue: Monitor\n"
+ for recipient in to:
+ input_text += "AdminCc: %s\n" % recipient
+ input_text += "Text: %s"