计算机网络---命令行邮箱登录发信及python实现

计算机网络套接字编程

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
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值