I don't understand how that can take more than two hours of someone who's a college senior (presuming you're a CS student). This is just a handful of lines of very simple python using one of the most documented and oldest web protocols. There's also a ton if similar examples online using php, java, etc. that should have taken more like ten minutes to write.
I wrote a very similar script several months ago, and it also took me longer than it should have. What kept me from doing it quickly was this nagging voice in the back of my mind telling me that there must be a better way to send a message through Gmail. (Or that I was somehow violating Gmail's TOS.)
Except it seems it doesn't support non-ascii characters in subject and body, server certificate is not checked. Also should From be escaped escaped or line lengths be limited? If message header, body is generated using email package e.g., [1] then it is not necessary to think about it.
[1]: http://stackoverflow.com/a/12550481
I'm currently a CS student, I'd argue that 2/3 of my class -- of not more! -- would need way more than two hours to accomplish the same 10 lines of code.
There exists a type of CS student that doesn't really seem to enjoy programming all that much -- if at all. They do the minimum required to nail that passing grade, and then never type another line until the next assignment. Thus, when they actually need to pull on some of those tools (like sending some mail), they aren't there.
Not that this guy is one of those, but I'm just saying, they exist, and in alarming numbers.
A good CS student spends some time up front reading all the source code of the libraries they're using, and some code that uses the libraries, to know what they're really doing, what they're capable of, and to learn from them. And by CS student, I include life-long students, and self-taught students.
I don't think that the code needs a CS student. A programmer, perhaps. But a motivated high school freshman with prior python experience can figure this out, given some time.
I'm just guessing here, but maybe the author didn't: know that email had a standard protocol, didn't know that gmail implemented, didn't find an exact sample (sometimes I get stuck on something and need a better example to understand an [harder] API)?