Clean server code
This commit is contained in:
parent
4019cc7670
commit
bcae0c2d43
1 changed files with 0 additions and 20 deletions
|
@ -50,18 +50,6 @@ class EmlServer(SMTPServer):
|
||||||
print('%s saved.' % filename)
|
print('%s saved.' % filename)
|
||||||
self.no += 1
|
self.no += 1
|
||||||
|
|
||||||
def EmlClientSend(sender, to, subject, msg, passwd):
|
|
||||||
mail_client = smtplib.SMTP('localhost',1025)
|
|
||||||
mail_client.ehlo()
|
|
||||||
mail_client.login(sender, crypter(passwd))
|
|
||||||
messg = MIMEMultipart()
|
|
||||||
messg['From'] = sender
|
|
||||||
messg['To'] = to
|
|
||||||
messg['Subject'] = subject
|
|
||||||
message = msg
|
|
||||||
messg.attach(crypter(MIMEText(message)))
|
|
||||||
mail_client.sendmail(sender, to, messg)
|
|
||||||
|
|
||||||
def run_server():
|
def run_server():
|
||||||
# start the smtp server on localhost:1025
|
# start the smtp server on localhost:1025
|
||||||
email_server = EmlServer(('localhost', 1025), None)
|
email_server = EmlServer(('localhost', 1025), None)
|
||||||
|
@ -70,13 +58,5 @@ def run_server():
|
||||||
except KeyboardInterrupt:
|
except KeyboardInterrupt:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
def run_client():
|
|
||||||
while True:
|
|
||||||
sender = input("<Sender Address>: ")
|
|
||||||
password = crypter(input("<Sender Password>: "))
|
|
||||||
to = input("<To>: ")
|
|
||||||
subject = input("<Subject>: ")
|
|
||||||
msg = input("<Message>: ")
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
run()
|
run()
|
Loading…
Reference in a new issue