I see several issues with your SMTP session.
First, gmail.com will be protected by SPF and DKIM and your message will likely be flagged as spam (or outright rejected) because it's clear that you're not sending on behalf of the real gmail.com.
Second, commands should be in all-caps. A server may accept or reject lowercase keywords.
Third, you need to leave a blank line between the mail headers and the body, so that part of your session would look like so: ...
DATA
354 Go ahead
From: ...
To: ...
Subject: ...
This is the first line of text.
This is the second line.
.
250 Queued
Having said that, many SMTP will require an encrypted connection (SMTPS), many ISPs will block port 25 for residential customers as an anti-spam measure, ESMTP should be preferred over SMTP etc.
If at all possible, you should use a full-featured mail library for this.