Send Email via Port 587 with Openssl

Please refer to the steps below to send Email via Port 587 with openssl

Telnet cannot be used as once you issues STARTTLS, the session will be encrypted and you will not be able to enter any commands

Port 587 – Securing SMTP communications using Transport Layer Security (TLS). STARTTLS

Prepare your username & password with PowerShell

#Convert your username to BASE64
$Username  = [System.Text.Encoding]::UTF8.GetBytes("[email protected]")

#Convert your Password to BASE64
$Password = [System.Text.Encoding]::UTF8.GetBytes("P@ssw0rd")

#Decode BASE64 back to normal text 
$DecodeBase64  = [System.Convert]::FromBase64String("bTN0ZXN0QGJlbmFsZWMuY29tLm15")

Open MobaXterm and enter the following commands

you can install openssl with “apt-get install openssl” if you have not done so

#Connect to port 587 with Starttls 
openssl s_client -starttls smtp -crlf -connect

#Enter helo / ehlo

#Login using Username & Password (BASE64 Format)
auth login

334 VXNlcm5hbWU6
334 UGFzc3dvcmQ6

235 2.7.0 Authentication successful

#Standard SMTP Telnet commands here
    mail from:<[email protected]> 
250 2.1.0 Sender OK
    rcpt to:<[email protected]>
250 2.1.5 Recipient OK
354 Start mail input; end with <CRLF>.<CRLF>
    subject: My Test Email 
    Testing Email 
    . #put . here to stop and start to deliver the email 
250 2.6.0 <[email protected]> [InternalId=72026601553977,] Queued mail for delivery

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top