CSc 423 Assignment 5

Fake Mail

Assigned
Due

Mar 29
55 pts
Apr 10
Extend assignment 4 by adding some additional parameters to control how the mail is sent. My file tmsg2.txt that looks like this:
recip=bennet@mc.edu subj=This Is A New Test Message sendername=Alphonse The Destroyer recipname=The Big Boss fakerecip=bossman@your.org Here is the information that said I would send you, though I just made it all up. So there you have it. AtD
And running the program looks like this:
bennet@desktop$ ./smlog3 smtp.gmail.com @gmailsmlog1 < tmsg2.txt S: 220 smtp.gmail.com ESMTP v5-20020a056820100500b005a52f7bed76sm598022oor.46 - gsmtp C: EHLO 192.168.1.136 S: 250-smtp.gmail.com at your service, [76.107.18.246] S: 250-SIZE 35882577 S: 250-8BITMIME S: 250-STARTTLS S: 250-ENHANCEDSTATUSCODES S: 250-PIPELINING S: 250-CHUNKING S: 250 SMTPUTF8 C: STARTTLS S: 220 2.0.0 Ready to start TLS C: EHLO 192.168.1.136 S: 250-smtp.gmail.com at your service, [76.107.18.246] S: 250-SIZE 35882577 S: 250-8BITMIME S: 250-AUTH LOGIN PLAIN XOAUTH2 PLAIN-CLIENTTOKEN OAUTHBEARER XOAUTH S: 250-ENHANCEDSTATUSCODES S: 250-PIPELINING S: 250-CHUNKING S: 250 SMTPUTF8 C: AUTH PLAIN AHNvbWV1c2VyaWQAc29tZXBhc3N3b3Jk S: 235 2.7.0 Accepted C: MAIL FROM:<tomstestacct700@gmail.com> S: 250 2.1.0 OK v5-20020a056820100500b005a52f7bed76sm598022oor.46 - gsmtp C: RCPT TO:<bennet@mc.edu> S: 250 2.1.5 OK v5-20020a056820100500b005a52f7bed76sm598022oor.46 - gsmtp C: DATA S: 354 Go ahead v5-20020a056820100500b005a52f7bed76sm598022oor.46 - gsmtp C: Date: Thu, 28 Mar 2024 23:41:52 -0500 C: From: Alphonse The Destroyer <tomstestacct700@gmail.com> C: Subject: This Is A New Test Message C: To: The Big Boss <bossman@your.org> C: C: Here is the information that said I would send you, though I C: just made it all up. C: C: So there you have it. C: C: AtD C: . S: 250 2.0.0 OK 1711687312 v5-20020a056820100500b005a52f7bed76sm598022oor.46 - gsmtp C: QUIT S: 221 2.0.0 closing connection v5-20020a056820100500b005a52f7bed76sm598022oor.46 - gsmtp bennet@desktop$
And the message is delivered to my campus email account, just as specified. Notice the differences from the previous assignment, though. The new keys sendername and recipname give human names for the sender and receiver of the message. Look at the From: and To: headers as transmitted in the log, and you'll see how this is sent: The human name is simply placed ahead of the the angle-bracketed email address. An additional key is the fakerecip, which gives the email address for the To: header on the email. (But not the RCPT TO: protocol command that specifies where to deliver the message.) In fact, the message was delivered to bennet@mc.edu as specified by RCPT TO:, and in the mailer it shows that it was delivered to bossman@your.org.

In assignment 4, the message input had keys subj, recip and sender, and those remain. Add the following: '
sendernameHuman name of the sender to be added to the From: header of the message.
recipnameHuman name of the recipient to be added to the To: header of the message.
fakesenderEmail address to specify in the From: header of the message instead of the MAIL FROM:
fakerecipEmail address to specify in the To: header of the message instead of the RCPT TO:
dateoffsetDate offset in seconds, a positive or negative value to to add to the Unix time before formatting the date for the email message. This will move the given sending date forward or back from the current time.
Each of these keys is optional, and will have effect only when set. Retain the program's original behavior when the particular key is not given. All of these make changes to the messages headers, not to any of the protocol commands. Using date offset takes a time period in seconds, so you may need to do a bit of arithmetic to choose an interesting value.

You may start with your own version of assignment 4, or with mine. I wrote it and tried it out with my Gmail test account. Google's server honored all the settings except the fake sender, which it just replaced with the true email address. It did keep the specified human name. I have not tried setting the send date in the future, but when I set the time a day earlier, the mail was so stamped, and my mail reader listed it as being sent at the earlier time. Of course, the message has many timestamped headers, and a quick look shows that Google received it a day after it was supposedly sent.

Other MTAs may deal more strictly with these settings, and return an error on a message it doesn't like.

Submission

When your program is working, nicely commented and properly indented, submit it using the form here