The first command is a shell command, the rest should be input to that command, but you've written them as a part of the shell script. What you're trying to do could be done with a here-document
:
openssl s_client ... <<EOF
auth plain
...
EOF
However, trying to send email using openssl s_client
? You're gonna' have a bad time. You're probably not going to get this to work at all. Use an MTA or (maybe even better) an MUA/MSA. If you need a lightweight MTA try esmtp-run
. Then you can set up your username/password in esmtprc
(or any other MTA/MDA configuration). If you feel the need to do this close to the metal:
/usr/sbin/sendmail -ti <<EOF
To: myself@gmail.com
From: myself@gmail.com
Subject: Test email
Date: Fri, 23 Mar 2018 22:26:38 0000 (GMT)
This is a test...
--
Myself
EOF