From 0dae270af93b5baeb31b65aff6116942d4139fe6 Mon Sep 17 00:00:00 2001 From: clamsawd Date: Tue, 27 Oct 2015 16:37:22 +0100 Subject: [PATCH] Fixed character error on Windows --- ip2e-daemon.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/ip2e-daemon.py b/ip2e-daemon.py index 5134e9e..194275b 100755 --- a/ip2e-daemon.py +++ b/ip2e-daemon.py @@ -183,7 +183,10 @@ while PublicIP <= 2: os.system("echo [ip2e-daemon] New IP - From "+CurrentIP+" to "+NewIP+" >> ip2e.log") MailMessage="[ip2e-daemon] Email was sent successfully" try: - os.system("sendEmail -q -f "+FromEmail+" -t "+ToEmail+" -u '[ip2e-daemon] IP has changed' -m 'ip2e - New IP is '"+NewIP+" -s "+SmtpFromEmail+" -xu "+FromEmailUser+" -xp "+FromEmailPass) + if os.name == "posix": + os.system("sendEmail -q -f "+FromEmail+" -t "+ToEmail+" -u '[ip2e-daemon] IP has changed' -m '[ip2e] New IP is '"+NewIP+" -s "+SmtpFromEmail+" -xu "+FromEmailUser+" -xp "+FromEmailPass) + elif os.name == "nt": + os.system("sendEmail -q -f "+FromEmail+" -t "+ToEmail+" -u [ip2e-daemon] IP has changed -m [ip2e] New IP is "+NewIP+" -s "+SmtpFromEmail+" -xu "+FromEmailUser+" -xp "+FromEmailPass) except: MailMessage="[ip2e-daemon] Fail to send email" print (MailMessage+" ("+ToEmail+")")