Closed flare04 closed 7 years ago
I added the subject on mine. My Function now looks like this
def send_opendoor_message(self, opentime):
syslog.syslog("Sending open door message. (%s)" % opentime)
self.door_open_text = config["messaging"]["door_open_text"]
config = self.config['smtp']
server = smtplib.SMTP(config["smtphost"], config["smtpport"])
if (config["smtp_tls"] == "True") :
server.starttls()
server.login(config["username"], config["password"])
SUBJECT = "Garage Door Open"
TEXT = self.door_open_text + " (%s)." % elapsed_time(opentime)
message = 'Subject: %s\n\n%s' % (SUBJECT, TEXT)
server.sendmail(config["username"], config["to_email"], message)
server.close()
self.msg_sent = True
That's a good point. I've been using the emails to send SMS messages to phones, so a subject was not needed.
I added in some lines to over come this issue. It now sends a full email. Let me know where I can send the new code if someone is interested.
@jkissner Could you upload the code here so I can use it? Thanks
@jkissner, if you forked the code, you can issue a merge pull request and I can merge it back in. otherwise, just send me the relevant code snippet and I can add it to the master.
The emails are sent correctly but do not have a subject.
I'll try and suggest some code soon.