그래서 간단한 텍스트 파일/TLS 메일을 지원하는 파이썬/트위스트 메일 서버가 필요합니다. 또한 smtplib을 사용하여 간단한 클라이언트 프로그램을 작성했습니다.python smtplib가 서버에서 광고 한 시작을 볼 수 없습니까?
# telnet localhost 5000
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
220 localhost.localdomain NO UCE NO UBE NO RELAY PROBES ESMTP
ehlo me
250-localhost.localdomain Hello 127.0.0.1, nice to meet you
250 STARTTLS
모든 좋은 지금까지 다음과 같이 나 텔넷을 사용하여 내 서버에 연결하는 경우
는 ESMTP는, 내 EHLO, STARTTLS는 보급을 발행 한 후 후, 광고됩니다. , 그래서 사람들은 다음과 같습니다, 지금 시도와 같은 솔루션을 제안하고 있습니다 : 그러나, 나는 온라인 smtplib의 smtp_ssl 클래스에 관련된 버그 읽었습니다 (http://bugs.python.org/issue4066 및 Failing to send email with the Python example 참조)
server = smtplib.SMTP('localhost', 5000) # my server is running on port 5000. Don't ask ;)
server.ehlo()
server.starttls('/opt/tesa/etc/certs/client/client.key', '/opt/tesa/etc/certs/client/client.crt')
server.set_debuglevel(1)
server.sendmail(fromaddr, toaddrs, msg)
server.quit()
을이 성공적으로 전송 내 메시지가 아니라 일반 텍스트를 통해 보입니다. 클라이언트의 출력은 서버의 EHLO 250 응답의 첫 번째 행 ("만나서 반갑습니다")을보고있는 것처럼 보이며 STARTTLS가 표시되지 않습니다. 따라서 서버가 자신의 STARTTLS를 발행하지 않는다고 가정합니다 (서버가 광고 한 경우에만이 작업을 수행하므로)? 따라서 일반 텍스트 메일로 유지됩니까?
# python smtplib_client.py
From: [email protected]
To: [email protected]
Enter message, end with ^D (Unix) or ^Z (Windows):
fsdfds
Message length is 45
**send: 'ehlo localhost.localdomain\r\n'
reply: '250 localhost.localdomain Hello 127.0.0.1, nice to meet you\r\n'
reply: retcode (250); Msg: localhost.localdomain Hello 127.0.0.1, nice to meet you
send: 'mail FROM:<[email protected]>\r\n'**
reply: '250 Sender address accepted\r\n'
reply: retcode (250); Msg: Sender address accepted
send: 'rcpt TO:<[email protected]>\r\n'
reply: '250 Recipient address accepted\r\n'
reply: retcode (250); Msg: Recipient address accepted
send: 'data\r\n'
reply: '354 Continue\r\n'
reply: retcode (354); Msg: Continue
data: (354, 'Continue')
send: 'From: [email protected]\r\nTo: [email protected]\r\n\r\nfsdfds\r\n.\r\n'
reply: '250 Delivery in progress\r\n'
reply: retcode (250); Msg: Delivery in progress
data: (250, 'Delivery in progress')
send: 'quit\r\n'
reply: '221 See you later\r\n'
reply: retcode (221); Msg: See you later
누구든지 나를 위해 조명을 켤 수 있습니까? 나는 어둠 속에서 여기있는 것처럼 보인다! 어느 때보 다
감사합니다 ...
귀하의 요청에 따라 게시물이 업데이트되었습니다 ...하지만 뭔가를 발견해도 자신의 답변을 추가 할 것입니다 ... –