function Curl_Mail_Command {
    local args="${*:-}"
    curl \
      --silent \
      --ssl-reqd \
      --url 'smtps://smtp.gmail.com:465' \
      --user "${EMAIL}:${EMAIL_PASSWORD}" \
      --mail-from "$EMAIL" \
      --mail-rcpt "$EMAIL" \
      --upload-file \
      "$args"
}
 
MSG="Some text with some ${some_var}"
Curl_Mail_Command <(echo -e "$msg")

Dumb version (via файл):

    curl \
      --silent \
      --ssl-reqd \
      --url 'smtps://smtp.gmail.com:465' \
      --user "${EMAIL}:${EMAIL_PASSWORD}" \
      --mail-from "$EMAIL" \
      --mail-rcpt "$EMAIL" \
      --upload-file mail.txt

Dumb version (via текст):

    curl \
      --silent \
      --ssl-reqd \
      --url 'smtps://smtp.gmail.com:465' \
      --user "${EMAIL}:${EMAIL_PASSWORD}" \
      --mail-from "$EMAIL" \
      --mail-rcpt "$EMAIL" \
      --upload-file <<< "text"
      --upload-file <(echo -e "some text w/ some $some_var")