4

smtp经过http代理

 2 years ago
source link: https://qidizi.github.io/smtp-over-http-proxy/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

smtp经过http代理

在使用python 的smtp时,有个需求是要走http代理,研究下,才发现就简单加一个CONNECT命令就解决

telnet 交互代码

mac:smtp-python qidizi$ /-/soft/inetutils/qidizi/bin/telnet 59.*.*.* 9797
Trying 59.*.*.*...
Connected to 59.*.*.*.
Escape character is '^]'.
CONNECT smtp.qq.com:25 HTTP/1.0

HTTP/1.0 200 OK

EHLO qidizi
220 smtp.qq.com Esmtp QQ Mail Server
250-smtp.qq.com
250-PIPELINING
250-SIZE 73400320
250-STARTTLS
250-AUTH LOGIN PLAIN
250-AUTH=LOGIN
250-MAILCOMPRESS
250 8BITMIME
auth login
334 VXNlcm5hbWU6
kkkk
334 UGFzc3dvcmQ6
kk
535 Error: ??ʹ????Ȩ???¼???????뿴: http://service.mail.qq.com/cgi-bin/help?subtype=1&&id=28&&no=1001256
quit
221 Bye
Connection closed by foreign host.

http代理就是通过CONNECT打开一个socket后,就无脑搬后续的您输入的内容到socket和然后再搬运socket中响应了给您。


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK