Additional Notes for Project 1
SMTP Server
How to Test Your Code
Content
l Grading
l How to Test Your Code?
l Telnet Command
l Mail Client: Sylpheed
Grading
l Grading is divided into two parts:
l Runnable 10%
l Test cases 90%
l Commands 60%
l Attachment 30%
Grading
l Runnable:
l Project should be runnable with Python 3.
Grading
l Test cases:
l TAs will manually communicate with your
mail server using SMTP commands by
telnet.
l TA will Use Sylpheed to send an email with
one attachment to your mail server run in
localhost
l Sylpheed: https://sylpheed.sraoss.jp/en/
l Due Date:
l Oct. 31, 2020 at 23:59
How to test your code?
l Your mail server is not a real server. It
doesn’t forward your message to the
destination email address. But just save
the message in your local machine.
l Two ways:
l Telnet command
l For basic commands
l Mail client (for example Sylpheed)
l For attachments
Telnet
l Because the port 25 is bounded with the mail service, so you
need to choose a new port beyond 1024, like 1111. If on your
own PC, the mail server is not enabled, you can still use port 25.
l In windows 7/10, it by default disables telnet service. You need to
enable it by yourself.
l When testing your code, first run it on your localhost, like your
PC.
l If you use backspace when typing commands, it will not work.
You should type again.
Telnet
l To start testing using Telnet
l Start running your server first
l Type the following command (change your
port number according your configurations)
l Type commands (see the following 2 slides)
Telnet
l Output
at the
sender side
May fail due to backspace
Type this dot to end the email content
Telnet
l Output at the email server
Mail Client
l Mail client
l For attachments
l You can use other email clients too
l Outlook 365/2016 may not be suitable.
l Set the SMTP server to be “localhost”
l Set the SMTP port number to be your own
port number chosen in your code like 1111.
l Suggested: Sylpheed. Available at
https://sylpheed.sraoss.jp/en/
Mail Client: Set Up Sylpheed
l You are recommended to use the
Windows version
l After installation, choose POP3 account
Mail Client: Set Up Sylpheed
l Email address can be arbitrary, even if it
does not exist
Mail Client: Set Up Sylpheed
l Remember to configure SMTP server
address as localhost
You can find the pop3 server on
the internet
! Please set the server to
localhost
Mail Client: Set Up Sylpheed
l Check and click on “Close” to finish
configuring email account
Mail Client: Set Up Sylpheed
l Now please go to Configuration to
change the port # and domain name
1
Mail Client: Set Up Sylpheed
You own port number
Remember to set domain name such as
gmail.com. Otherwise, you may receive error 501
Mail Client: Send Email
l We compose an email with attachments
Attachment button
We attach two images here
as an example
Mail Client: Send Email
To avoid encoding error, you need to
set the message as UTF-8 encoding.
You need to perform this step if you
are using this software in some non-
English languages.
Mail Client: Send Email
We can also check the message source in
Sylpheed. It helps you to debug the code.
Please check the attribute struct carefully.
Mail Server: Received Files
Files generated at
the server side
Message.txt
Our program will generate the message.txt and extract the attachments.
In this example, the code extracts two images.
Note that your output might not the same as this example.
It is OK if the core part was finished.
Mail Server: Output
…(We omit the long attachments’
encodings here)..
Here are the mail server’s output. You
can choose to disable printing this
much information.
But it can help your debugging process.