Your task is to write an email client.
It should be able to connect to an email server, and deliver email to
that server. You must use the SMTP protocol.
Points |
Task |
10 |
Makes a socket to the email server |
10 |
Gets the username and email server name from the user |
10 |
Gets the body of the message from the user |
10 |
Can figure out the MX server programatically (Extra Credit. Very hard. Most people don’t get this!) |
60 |
User actually gets email |
10 |
Prints an informative error message if the user does not exist |
-5 |
Every error check missing from read or write |
-10 |
Each day after Fri Feb 23th |
Here's a sample dialog between a user
and the program
Send to whom?> randy Message Sent |
220 mx.google.com ESMTP p19-20020a5d9853000000b007c7432a1405si101698ios.20 - gsmtp Vote
for me |
Checklist:
connect to the server
Read from the server. If they don't reply, you're blocked!
send "HELO sourcehostname\r\n"
check for a good reply
send "MAIL FROM:\r\n"
check for a good reply
send "RCPT TO:\r\n"
Check for a good reply
Send "DATA\r\n"
Check for a good reply
Send "To:destusername@destsourcename\r\n"
Send "From: sourceusername@sourcehostname\r\n"
Send "Message-ID: \r\n"
Send "Subject: thesubject\r\n"
Send "Date: thedate\r\n"
Send "\r\n"
Send the text of the message and then "\r\n"
Send ".\r\n"
Check for a good reply
Send "QUIT\r\n"
Check for a good reply
exit the program.
Go check you email. It PROBABLY in your spam folder