/
voidbeholder
/
test_repo
Обзор
Документация
Войти
/
voidbeholder
/
test_repo
Код
Запросы
1
Задачи
Вики
Пакеты
0
Релизы
0
Аналитика
Безопасность
pg
agent_client.py
34 строки
986 B
voidbeholder
upload files
24 мар 2025, 11:34
24 мар 2025, 11:34
57ad812
Код
Авторство
О чём код?
""" SMTP Mail Agent/Client """ import sys from email import Email from exceptions import EarlyTerminationError, SocketError, SMTPBreakOfProtocolError def SMTP_agent_client_engine(): """Engine for prompting a command-line user for email data and sending the email using SMTP.""" # Initialize email for user to fill email = Email() # Fill email with user input try: email.fill() # Terminate program if encounter early EOF except EarlyTerminationError: return # Send email to command-line-argument-specified address server_hostname, welc_sock_port_num = sys.argv[1], int(sys.argv[2]) try: email.send(server_hostname, welc_sock_port_num) # Terminate on SocketErrors and SMTPBreakOfProtocolErrors # (having already closed whatever connection and alerted the user) except SocketError: return except SMTPBreakOfProtocolError: return if __name__ == "__main__": SMTP_agent_client_engine()