Court documents say that in some of the more than 40 messages Naeem Ahmed sent to Tatiana Schlossberg, he called himself her husband.
The papers say he continued to send messages even after a warning from the Kennedy family's security firm.
The messages began in October 2008 when Schlossberg was an 18-year-old Yale student and ended in November.
Defense lawyer Gerald Hertz says that they were harmless and that Ahmed never hurt anybody. He has asked for a mental evaluation.