计算机网络套接字编程
Your task is to develop a simple mail client that sends email to any recipient. Your client will need to connect to a mail server, dialogue with the mail server using the SMTP protocol, and send an email message to the mail server. Python provides a module, called smtplib, which has built in methods to send mail using SMTP protocol. However, we will not be using this module in this lab, because it hide the details of SMTP and socket programming.
创建一个向任何接收方发送电子邮件的简单邮件客户。客户端必须与邮件服务器创建一个TCP连接,使用SMTP协议与邮件服务器进行交谈,经该邮件服务器向某接收方发送一个电子邮件报文,最后关闭邮件服务器的TCP连接
postfix学习
在命令行下可以实行
cyc@cyc-Inspiron-7460:/home/fmaster$ netcat smtp.163.com 25 //bash
220 163.com Anti-spam GT for Coremail System (163com[20141201]) //server
helo 13949569027@163.com //client
250 OK //s
auth login //c
334 dXNlcm5hbWU6 //s
//此处添加用户名的账号的base64编码c
334 UGFzc3dvcmQ6 //s
//此处输入密码的base64编码 //c
235 Authentication successful
mail from: <13949569027@163.com>
250 Mail OK
rcpt to: <1219215078@qq.com>
250 Mail OK
data
354 End data with <CR><LF>.<CR><LF>
from:13949569027@163.com
to:1219215078@qq.com
Subject:My
hi,huhi
hu
aa
.
250 Mail OK queued as smtp10,DsCowAAXicSbn6tbZwHHSA--.16143S2 1537974289
下面看python代码
from socket import *
import base64
def receiveFromServer():
msg = clientSocket.recv