QQ:928900200
Assignment 1 CS 436 W15
Mail User Agent / Server
Work on this assignment is to be completed individually
This assignment is divided into three parts. In the first part, you use telnet to manually send
email through an SMTP mail server. In the second part, you write a client program that
performs the same action. In the third part, you write a server program that simulates an email
server.
Part 1: Sending Email with Telnet
In this part you should try to send an email to yourself (myusername@uwaterloo.ca). This
means you need to know the host name of the mail server for your mail domain (here
uwaterloo.ca). To find out this information, you can query DNS for the MX record that
maintains information about your mail domain. The following command queries DNS for the
mail servers responsible for delivering mail to the uwaterloo.ca domain:
nslookup -type=MX uwaterloo.ca
Usually, there may be several mail servers in response to this command. Suppose that the name of one
of them is mxer.uwaterloo.ca. In this case, the following command will establish a TCP connection to
this mail server. (Notice that the port number 25 is specified on the command line.)
telnet mxer.uwaterloo.ca 25
At this point, the telnet program will allow you to enter SMTP commands, and will display the
responses from the mail server. For example, the following sequence of commands would
send email to yourself from your account myusername
HELO myusername
MAIL FROM: <myusername@uwaterloo.ca>
RCPT TO: <myusername@uwaterloo.ca>
DATA
SUBJECT: saying hello to myself
Hello to myself!
.
QUIT
The SMTP protocol was originally designed to allow people to manually interact with mail
servers in a conversational manner. For this reason, if you enter a command with incorrect
syntax, or with unacceptable arguments, the server will return a message stating this, and will
allow you to try again.
To complete this part of the assignment, you should send an email message to yourself and
verify that it was delivered.
Part 2: Sending Email with Java
Java provides an API for interacting with the Internet mail system, which is called JavaMail.
However, we will not be using this API, because it hides the details of SMTP and socket
programming. Instead, you should write a Java program that establishes a TCP connection
with a mail server through the socket interface, and sends an email message.
You can place all of your code into the main method of a class called EmailSender. Run your
program with the following simple command:
java EmailSender <emailserver_hostname> <emailserver_port_number>
<my_username> <my_emailaddress>
where the inputs <emailserver_hostname>, <emailserver_port_number>, <my_username>,
<my_emailaddress> should be passed in the given order.
You will include in your code the details of the subject and the particular email message you
are trying to send. Your program should read and display messages sent to and received
from the mail server. The following is a sample execution
220
***********************************************************************************
********************************************************
HELO n2limam
250 mailchk-m06.uwaterloo.ca Hello v1020-wn-157-157.campus-dynamic.uwaterloo.ca
[10.20.157.157], pleased to meet you
MAIL FROM: n2limam@uwaterloo.ca
250 2.1.0 n2limam@uwaterloo.ca... Sender ok
RCPT TO: n2limam@uwaterloo.ca
250 2.1.5 n2limam@uwaterloo.ca... Recipient ok
DATA
354 Enter mail, end with "." on a line by itself
SUBJECT: saying hello to myself
HELLO to myself!
.
250 2.0.0 t25FUn8p019830 Message accepted for delivery
QUIT
221 2.0.0 mailchk-m06.uwaterloo.ca closing connection
Connection closed by foreign hos
you must then be able to find the message in your mailbox.
Part 3: Receiving Email with Java
You should write a program that emulates a mail server. You can place all of your code into
the main method of a class called EmailServer. Run your program with the following simple
command:
java EmailServer <emailserver_port_number>
EmailServer should create a ServerSocket and bind it to port number
<emailserver_port_number> and expect TCP connection from EmailSender. The same
<emailserver_port_number> should be used to run both EmailServer and EmailSender.
EmailServer and EmailSender should run on different machines e.g. on ubuntu1204-
004.student.cs.uwaterloo.ca and ubuntu1204- 006.student.cs.uwaterloo.ca respectively. A
sample execution would be:
...@ubuntu1204-004:~$java EmailServer 59991
...@ubuntu1204-006:~$java EmailSender ubuntu1204-004.student.cs.uwaterloo.ca 59991
whoever whoever@wherever.ca
The EmailServer will have to act as a mail server, by recognizing commands, errors and
using the right reply codes:
Command
DATA
HELO
MAIL
FROM
QUIT
RCPT TO
Reply Code
354
250
250
221
250
Errors to be handled are those related to code 500 (unrecognized command) and 503 (out of
order command) as shown in the following sample execution:
220
***********************************************************************************
********************************************************
HELLOOO n2limam
500 5.5.1 Command unrecognized: "HELLOOO n2limam"
HELO n2limam
250 mailchk-m06.uwaterloo.ca Hello ubuntu1204- 004.student.cs.uwaterloo.ca
[129.97.167.42], pleased to meet you
DATA
503 5.0.0 Need MAIL command
MAIL FROM: <n2limam@uwaterloo.ca>250 2.1.0 <n2limam@uwaterloo.ca>... Sender ok
DATA
503 5.0.0 Need RCPT (recipient)
RCPT TO: <n2limam@uwaterloo.ca>
250 2.1.5 <n2limam@uwaterloo.ca>... Recipient ok SUBJECT:
500 5.5.1 Command unrecognized: "SUBJECT:"
DATA
354 Enter mail, end with "." on a line by itself SUBJECT: saying hello to myself
Hello to myself!
..
...
QUIT
.
250 2.0.0 s14NYlwf023218 Message accepted for delivery QUIT
221 2.0.0 mailchk-m06.uwaterloo.ca closing connection
Procedures
Due Date
The assignment is due on March 25 2015, at midnight (11:59 PM).
Late submission policy: 10% penalty every late day, up to 3 late days. Submissions not
accepted beyond 3 late days.
Hand in Instructions
Submit all your files in a single compressed file (.zip, .tar etc.) using LEARN.
You must hand in the following files / documents:
– Source code files.
– README file: this file must contain instructions on how to run your program, which
undergrad machines your program was built and tested on, and what version of compilers
you are using.
Your implementation will be tested on the machines available in the undergrad environment.
Documentation
Since there is no external documentation required for this assignment, you are expected to
have a reasonable amount of internal code documentation (to help the markers read your
code). You will lose marks if your code is unreadable, sloppy, inefficient, or not modular.
相关推荐
### CS193P iOS Application Development - Assignment 1 Walkthrough #### Objective The main objective of this assignment is to reproduce the demonstration given in class, which involves building a ...
CS231N计算机视觉公开课的作业答案,只有assignment1,其中包含了作业,还有作业的答案,还有在网上下载的数据集,都在里面了。这个作业是用的anaconda的jupyter来做的。 如果后期的软件下载,或者如何打开使用,...
**斯坦福大学cs224d课程作业1详解** 斯坦福大学的cs224d是一门关于深度学习与自然语言处理(Deep Learning for Natural Language Processing)的高级课程。这门课程涵盖了各种自然语言处理技术,包括词嵌入、序列...
【标题】"cs231n assignment1"指的是斯坦福大学计算机科学课程CS231n(视觉识别)的第一项作业。这门课程主要关注深度学习在计算机视觉领域的应用,而"assignment1"则涵盖了该课程的基础内容和实践操作。 【描述】...
英文的,含书上所有ethereal实验... The two simplist are Asssigment 2a (Simplied Mail User Agent) and Assignment 3 (UDP Pinger). We recommend that beginner Java programmers start with Assignments 2a and 3.
【cs231n深度学习作业1】是斯坦福大学cs231n课程的初步实践环节,旨在帮助学生深入理解深度学习的基本概念和技术。在这个作业中,学生将接触到一系列关键的深度学习模型和方法,为后续的学习打下坚实基础。 深度...
大蟒蛇Python 学习 Stanford课程 CS41 assignment1 intro.py
CS231n的Assignment, 用Python3.6.3写的,大家可以参考一下,
CS224d assignment2作业解答代码。网上目前能找到的解答好像都是基于低版本tensorflow,在tensorflow r1.3下会出错。此次上传的代码经过了个人修改,确保可以在tf r1.3下成功运行。
这是笔者实现的stanford 的cs231n的课程实践的代码样例,实现的功能比较完整,其中包括softmax,svm,2-layer-neural-network,knn和features这五个项目
【CS231n assignment2】是斯坦福大学计算机视觉课程CS231n的第二份编程作业,它深入探讨了神经网络的基础,特别是两层神经网络的实现。这个作业基于Python编程语言,并且利用了numpy库来处理矩阵运算,这对于理解和...
【cs231n-2018-Assignment3】是斯坦福大学计算机科学课程CS231n(视觉识别)2018年的第三次作业,这个资源包含了spring1718学期最新的源代码和学习资料。这个作业的核心是深入理解和应用深度学习,特别是卷积神经...
【标题】"cs231n-Assignment-1 python." 是斯坦福大学计算机视觉课程CS231n的作业一,使用Python3.6语言编写。这个作业涉及到的基础知识点主要涵盖了机器学习,特别是监督学习中的分类算法,如K近邻(KNN)、支持...
【深度学习】与【计算机视觉】的基石:CS231n 斯坦福大学的CS231n课程,全称为“视觉识别”,是全球范围内深度学习和计算机视觉领域的权威课程之一。该课程由著名学者李飞飞教授(Li Fei-Fei)主讲,旨在教授学生...
【标题】"CS1_Assignment1" 是一个计算机科学入门课程的第一份编程作业,主要涉及JavaScript语言。这个作业可能旨在帮助学生建立起JavaScript编程基础,理解基本语法和常见数据类型,以及掌握函数、控制流程和对象等...
【cs231n-Assignment3】是斯坦福大学计算机科学课程CS231n(视觉识别)的第三项作业,主要关注深度学习在图像识别领域的应用。这个作业可能涉及训练和评估卷积神经网络(CNNs),以及对现有模型如SqueezeNet的使用和...
Cs231n_Assignment1_Q3.docx 本文档属于计算机视觉(CV)领域,具体是关于 Cs231n 课程的 Assignment 1 的第三个问题。该文档主要讲解了加载和预处理 CIFAR-10 数据集的步骤,以便为后续的线性分类器做准备。 Cs...
《Karel编程实践:Stanford编程方法学与Assignment1解析》 Karel编程语言,源自斯坦福大学的编程方法学课程,是一种简单的教学语言,专为初学者设计,特别是那些初次接触编程概念的学生。它的核心目标是通过一个名...
"北航计算机研究生课程 算法设计与分析 Assignment_1" 本资源是北航计算机研究生课程中的算法设计与分析 Assignment_1,涵盖了动态规划和状态空间搜索等算法设计技术。 一、动态规划算法设计 在该Assignment中,...
【Spring1819_Assignment1.zip】是一个包含斯坦福大学计算机科学课程CS231n相关作业的压缩包。CS231n是著名的视觉识别系统课程,专注于深度学习和卷积神经网络(Convolutional Neural Networks)在图像识别中的应用...