To begin, create a file from the contents of the letter

From: "User Name" <username@gmail.com>
To: "John Smith" <john@example.com>
Subject: This is a test
Hi John,
I’m sending this mail with curl thru my gmail account.
Bye!

Well, then we call the curl command

curl --url 'smtps://127.0.0.1:465' --ssl-reqd \
  --mail-from 'username@domain.local' \
  --mail-rcpt 'john@example.com' \
  --upload-file testmail.eml \
  --user 'username@domain.local:PassWord'