我正在尝试使用下面所示的脚本通过 openssl 发送电子邮件,但在显示证书、登录名和密码正确后退出。
#!/bin/bash
username="[email protected]";
password="mypassword";
emailFrom="[email protected]";
emailTo="[email protected]";
subject="MySubject";
openssl s_client -starttls smtp -connect smtp.gmail.com:587 -crlf <<EOF
helo
auth login
$(echo $username | base64)
$(echo $password | base64)
mail from:$emailFrom
rcpt to:$emailTo
Data
From: $emailFrom
To: $emailTo
Subject: $(echo $subject)
$(< body.txt)
.
EOF
仅输出此内容,并且不发送电子邮件。我已经显示了最后几行输出
SSL handshake has read 3113 bytes and written 466 bytes
---
New, TLSv1/SSLv3, Cipher is ECDHE-ECDSA-AES128-GCM-SHA256
Server public key is 256 bit
Secure Renegotiation IS supported
Compression: NONE
Expansion: NONE
No ALPN negotiated
SSL-Session:
Protocol : TLSv1.2
Cipher : ECDHE-ECDSA-AES128-GCM-SHA256
Session-ID: 128122902648ECB1A0C92D2BCD02F7D6CCC25D61A6531A43A316045B387D380A
Session-ID-ctx:
Master-Key: A5307264BA8A784FF3D031048A0EA2FE0109AA5DA2F79BAE9765AF45F15997A89B0E98796C4E5FE4E2E524FC98E7E3A3
Key-Arg : None
PSK identity: None
PSK identity hint: None
SRP username: None
TLS session ticket lifetime hint: 100799 (seconds)
TLS session ticket:
0000 - 01 ff e1 cc a1 bb 7d 31-13 14 0b 78 c4 b1 bd ec ......}1...x....
0010 - 3c 3c cc de 1e 9b a1 b2-60 2a 01 85 b5 76 53 e3 <<......`*...vS.
0020 - 31 b7 30 83 8e 88 3a cc-32 67 6b 1b d7 fe ca 69 1.0...:.2gk....i
0030 - a9 a1 33 ae 86 24 71 4b-2b 87 88 9b 50 ce 04 63 ..3..$qK+...P..c
0040 - 0f b0 e4 6c b3 ea f3 44-81 72 2f e3 e8 e4 66 d2 ...l...D.r/...f.
0050 - 93 25 b6 19 5b 37 58 8d-a3 40 82 22 00 74 7f f4 .%..[7X..@.".t..
0060 - d6 28 87 0c b3 46 ca 15-bd 19 fb f0 45 a5 30 e0 .(...F......E.0.
0070 - 97 99 e4 6d ac a5 8a 28-53 1a d5 4e 4d b5 1b a3 ...m...(S..NM...
0080 - de 51 d2 a4 a7 f5 fe 1e-a3 2d 02 3e c5 e3 25 b1 .Q.......-.>..%.
0090 - f1 54 19 cd 6f e0 be 05-fd 3f 59 e2 b6 a1 8a 51 .T..o....?Y....Q
00a0 - eb 83 4c e9 05 2a 43 e9-41 68 5f da d2 23 20 8e ..L..*C.Ah_..# .
00b0 - 36 8c 1f 67 33 84 28 2f-f9 b3 98 6b 0d 11 d9 41 6..g3.(/...k...A
00c0 - 25 bc b0 93 b0 67 49 c6-6e 9b 5f 1d 30 2e 22 f3 %....gI.n._.0.".
00d0 - 3a f1 d3 ca 12 fe 2a fc-3a 3f c7 75 f8 :.....*.:?.u.
Start Time: 1611343135
Timeout : 300 (sec)